From: Nicolas Guichard Date: Thu, 2 Mar 2023 17:38:04 +0000 (+0100) Subject: Fix Cache-Control header of non-versioned assets X-Git-Tag: v24.0.11rc1~1^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F37250%2Fhead;p=nextcloud-server.git Fix Cache-Control header of non-versioned assets Non-cache-busted assets such as /dist/core-main.js also matched the regex meant for cache-busted assets (note the ? at the end of the regex). The FilesMatch directive for cache-busted assets coming after the non-cache-busted version all assets actually got the immutable flag in their Cache-Control header. This caused client-side errors on updates. Query strings are not actually passed to FilesMatch directives so we need another way to tell cache-busted/versionned assets apart from non-versioned assets, here using If/Else directives. Signed-off-by: Nicolas Guichard --- diff --git a/.htaccess b/.htaccess index dd0fce231e8..956e29ea7c4 100644 --- a/.htaccess +++ b/.htaccess @@ -41,11 +41,12 @@ # Add cache control for static resources - Header set Cache-Control "max-age=15778463" - - - - Header set Cache-Control "max-age=15778463, immutable" + + Header set Cache-Control "max-age=15778463, immutable" + + + Header set Cache-Control "max-age=15778463" + # Let browsers cache WOFF files for a week