mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
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 <nicolas@guichard.eu>
This commit is contained in:
parent
9137908b2c
commit
7aae6c12e5
1 changed files with 6 additions and 5 deletions
11
.htaccess
11
.htaccess
|
|
@ -41,11 +41,12 @@
|
|||
|
||||
# Add cache control for static resources
|
||||
<FilesMatch "\.(css|js|svg|gif|png|jpg|ico|wasm|tflite)$">
|
||||
Header set Cache-Control "max-age=15778463"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.(css|js|svg|gif|png|jpg|ico|wasm|tflite)(\?v=.*)?$">
|
||||
Header set Cache-Control "max-age=15778463, immutable"
|
||||
<If "%{QUERY_STRING} =~ /(^|&)v=/">
|
||||
Header set Cache-Control "max-age=15778463, immutable"
|
||||
</If>
|
||||
<Else>
|
||||
Header set Cache-Control "max-age=15778463"
|
||||
</Else>
|
||||
</FilesMatch>
|
||||
|
||||
# Let browsers cache WOFF files for a week
|
||||
|
|
|
|||
Loading…
Reference in a new issue