-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Cache-Control header of non-versioned assets #37010
Fix Cache-Control header of non-versioned assets #37010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes perfectly sense IMO
85870b5
to
9b9f2c7
Compare
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>
9b9f2c7
to
7aae6c1
Compare
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
/backport to stable26 |
/backport to stable25 |
/backport to stable24 |
Summary
After updating from Nextcloud 24 to Nextcloud 25 people started to complain about an empty landing page until they refreshed the page ignoring their local cache (aka Ctrl+F5).
I noticed that all assets including non-cache-busted ones (such as /dist/core-main.js) had their
Cache-Control
header set toimmutable
so the browsers didn't even send conditional requests to check if a new version was available.TODO
This prevents the issue for users who don't have the files cached yet but does not fix existing caches, only implementing cache-busting for all assets would solve that. Should it be added to a list of known bugs somewhere?
This was introduced by 7dddbd0 so should be backported to NC 24 and 25 I think.
Checklist