From 18215ded8e8ad01a28009679c699a27cac4e06fb Mon Sep 17 00:00:00 2001 From: William Allen Date: Fri, 9 Oct 2026 10:12:15 -0400 Subject: [PATCH] Cache project logos Project logos and other uploaded images aren't cached, which leads to the images filling incrementally when loading `/projects`. Loading all the images on every request also increases backend load. This PR adds `cache-control` headers to tell browsers to cache these types of images locally. In a local test, this made the `/projects` page feel faster since all the images appeared to load at once. --- app/Http/Controllers/ImageController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 81c0bbe082..66d04a1bf2 100755 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -20,6 +20,9 @@ public function __invoke(Image $image): StreamedResponse return response()->stream(function () use ($image): void { echo $image->Data; - }, 200, ['Content-type' => $image->Extension]); + }, 200, [ + 'Content-type' => $image->Extension, + 'Cache-Control' => 'private, max-age=31536000, immutable', + ]); } }