From e43c1d5c44c826f8c8fb831abe07cf512a3d6a89 Mon Sep 17 00:00:00 2001 From: miqrogroove <1371835+miqrogroove@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:09:10 -0400 Subject: [PATCH] Enabled client-side caching in the IIIF service. Arbitrary value of 1 hour allows web browsers to close and re-open overlay viewers without requesting image tiles every time. Complements providence/pull/1612 --- app/lib/Service/IIIFService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/lib/Service/IIIFService.php b/app/lib/Service/IIIFService.php index 443fa311ce..7f17311c5d 100644 --- a/app/lib/Service/IIIFService.php +++ b/app/lib/Service/IIIFService.php @@ -43,6 +43,8 @@ class IIIFService { * @throws Exception */ public static function dispatch(string $identifier, RequestHTTP $request, ResponseHTTP $response) { + $response->addHeader('Cache-Control', 'max-age=3600, private', true); // Cache all responses for 1 hour. + $va_path = array_filter(array_slice(explode("/", $request->getPathInfo()), 3), 'strlen'); $vs_key = $identifier."/".join("/", $va_path);