-
Notifications
You must be signed in to change notification settings - Fork 2.3k
nginx: fix response headers for assets #11472
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
Conversation
ce213fb to
f09be76
Compare
Nginx resets all response headers in a location block, if it contains any "add_header" directive. When setting the "Cache-Control" header for static assets, this was originally worked around by using the "expires" directive instead. #8083 however added the "immutable" flag for assets with "v=" query parameter and broke all other response headers for assets that way. This commit fixes this by re-adding all reponse headers explicitly for those assets. Originally those doubled code was removed thanks to using "expires", but I see no way to have both: the "immutable" flag as well as avoiding doubled headers via "expires" directive. Additionally, this commit avoids the trailing comma and space in the Cache-Control header for assets without "v=" query parameter, and adds sets the wasm MIME type in a cleaner/more consistent way together with js/mjs, and rephrases the broken comment sentence. Signed-off-by: MichaIng <micha@dietpi.com>
f09be76 to
4ef607d
Compare
|
/backport to stable28 |
|
/backport to stable27 |
|
/backport to stable26 |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
☑️ Resolves
Nginx resets all parent
add_headerdirectives in a location block, if itself contains anyadd_headerdirective. When setting theCache-Controlheader for static assets, this was originally worked around by using theexpiresdirective instead. #8083 however added theimmutableflag for assets withv=query parameter viaadd_headerdirective, and broke the parent blockadd_headerdirectives for common security response headers for assets that way.This commit fixes this by re-adding all response headers explicitly for those assets. Originally this doubled code was removed thanks to using
expires, but I see no way to have both: theimmutableflag as well as avoiding doubledadd_headerdirectives viaexpiresdirective.Additionally, this commit avoids the trailing comma and space in the
Cache-Controlheader for assets withoutv=query parameter, sets thewasmMIME type in a cleaner/more consistent way together withjs/mjs, and rephrases the comment sentence.🖼️ Screenshots