From 644052cbdbd82c0c8f3e69dd49249badb7cb95ba Mon Sep 17 00:00:00 2001 From: William Allen Date: Fri, 9 Oct 2026 09:50:14 -0400 Subject: [PATCH] Add `immutable` to static asset cache headers Adding `immutable` to cache entries removes a route-trip check in some browsers. Along the way, I also addressed an issue where GraphiQL was improperly cached, and added revision query strings to each of our logo links. --- public/.htaccess | 8 ++++++-- resources/views/components/footer.blade.php | 2 +- resources/views/components/header.blade.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/.htaccess b/public/.htaccess index 0a17221ce1..e2c38f6b0a 100755 --- a/public/.htaccess +++ b/public/.htaccess @@ -9,6 +9,9 @@ RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + # Static files in these directories are versioned or never change... + RewriteRule ^(assets|fonts|images|img)/ - [E=CDASH_IMMUTABLE:1] + # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ @@ -21,8 +24,9 @@ - - Header set Cache-Control "max-age=31536000" + + Header set Cache-Control "max-age=31536000, immutable" env=CDASH_IMMUTABLE + Header set Cache-Control "no-cache" env=!CDASH_IMMUTABLE Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; font-src 'self' data:; img-src 'self' data:" diff --git a/resources/views/components/footer.blade.php b/resources/views/components/footer.blade.php index 8d4d38af93..ffc580d48f 100755 --- a/resources/views/components/footer.blade.php +++ b/resources/views/components/footer.blade.php @@ -4,7 +4,7 @@