-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Don't cache private content in Varnish, only 200 and 404 responses. A… #36524
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
Don't cache private content in Varnish, only 200 and 404 responses. A… #36524
Conversation
…lso fixes some whitespace inconsistencies.
Hi @hostep. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review. For more details, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
It probably does not make sense to run tests for this PR, not sure if there are automated tests that use Varnish? But let me trigger it just once ... @magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Unit Tests,Static Tests,Functional Tests EE |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@engcom-Echo, @hostep is correct, you missed the test for the private header. Anything with a private header should not be cached. |
@hostep We have verify on
Let us know if we are missing something here. |
I'm not an Varnish expert, so maybe we can pull in one here. @gquintard: what do you think about this fix? For context, this originates from this discussion here: #36492 (comment) Do the changes in this PR look good to you? (use this link to view them without whitespace changes). Are my testing scenario's described correctly? Anything else that can help @engcom-Echo further? |
@gquintard Have you had an opportunity to review the mentioned comment ? |
the one I answered to? Yes. I will write the |
@hostep, I've opened hostep#2 on your fork. I just adds a varnishtest dev/tests/varnish/*.vtc You'll notice the test failing before your patch is applied, and passing after. The test case will be cleaner if/once #28944 is merged, but it will do for now. |
(cherry picked from commit ca32d5a)
Awesome! I've cherry-picked your commit and added it to this PR here. I can confirm the test passes with the fixes provided here and fails without them. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests EE,Functional Tests B2B,Integration Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
…lso fixes some whitespace inconsistencies.
Description (*)
#28927 accidentally added a bug, where it allows any response that doesn't have a 200 or 404 status code to become cached. Unless the Cache-Control header contains
private
.This is incorrect, it should only cache 200 or 404 responses, unless they contains Cache-Control header
private
, not any other status codes.I've also noticed some whitespace inconsistencies where indentation used 3 spaces instead of 4, so those got fixed as well here. Append
?w=1
to the url of this PR to see only the relevant changes.Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Cache-Control: private
and HTTP status 200 or 404 does not get cachedCache-Control: private
and HTTP status 301 or 302 does not get cachedQuestions or comments
@icecactus: I hope I understood your report correctly, feel free to correct me or give better steps of how to test this fix
Contribution checklist (*)