-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add Cache-Control header to knockout partials #25325
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
Hi @paveq. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
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.
Hi @paveq Thanks for your contribution
Hi @rodrigowebjump, thank you for the review.
|
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.
Hi @paveq,
Could you also add this change to nginx.conf.sample to make both installations consistent?
This is now added. |
Hi @ihor-sviziev, thank you for the review.
|
Hello @paveq. Thank You for Your contribution. Could You please help us a bit with Manual Testing and give us some more details on it so that we can be sure we do everything correctly. For example in "Verify that returned response to .html static content file has Cache-Control header" please specify some concrete .html file. Also "Open another category page" means another page of the same category or a page of some other category? Besides do we need to switch to Developer or to Production mode for executing all of that. There also may be some other details will help us to correctly reproduce the scenario. Thank You in advance. |
@magento give me test instance |
Hi @ihor-sviziev. Thank you for your request. I'm working on Magento instance for you |
@magento give me 2.3-develop instance |
Hi @ihor-sviziev. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @ihor-sviziev, here is your new Magento instance. |
@engcom-Bravo,
On 2.3-develop: On this PR: In order to make full testing - you need to setup Magento with CDN, for instance CloudFlare or CloudFront and re-check that requests are cached in browser and no requests for .html files were sent to server. I just tried to test it on test instances and found another issue - #25578. |
Thank You, @ihor-sviziev. Before proceeding to full testing, can You tell me please if this fix is supposed to be detected on the local environment. Yes, I see it works on the instances You requested above. But I can't see it working on my local instance. In fact Cache-Control header is present only for the main requested recourse, i.e. for example for the testcategory.html if we talk about category page with testcategory url key. Besides it appears only in developer mode and looks differently meaning it contains more information than just "public". |
✔️ QA Passed |
Hi @paveq, thank you for your contribution! |
Description (*)
This PR adds Cache-Control headers to knockout partials (.html static content files). Previous PR #8000 failed to add this.
Fixed Issues
Without Cache-Control header in same cases when using caching proxies such as Cloudflare to serve files, end user browser does 304 check each time on every page. This highly depends on proxy configuration, but there should not be any reason not to set Cache-Control header. Is seems with just Expires header set, there's different interpretations what logic should be used for revalidation.
In this PR we set Cache-Control to public, which is same value for all static content files. There is no need for browser to revalidate these requests, as invalidation is handled by static content versioning.
Manual testing scenarios (*)
Contribution checklist (*)