-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Varnish 6 VCL optimization #36796
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
Varnish 6 VCL optimization #36796
Conversation
Hi @peterjaap. 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 |
# Bypass customer, shopping cart, checkout | ||
if (req.url ~ "/customer" || req.url ~ "/checkout") { | ||
return (pass); | ||
} | ||
|
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.
Could you please explain this change? Why you decided to remove this part?
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.
@peterjaap What was the deal again with this one? Did you say that Magento already returns Cache-Control: private, no-cache, no-store
for these paths? Please clarify, I don't remember the exact reason.
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.
Yes exactly
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.
@ihor-sviziev is that an acceptable answer?
Long story short: no need to write code to bypass the cache if Magento prevents these pages from ending up in the cache.
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.
@peterjaap @ThijsFeryn Make sense, thx.
Please point me to where this code is located. Does it works based on the path, or it's inside the controllers?
If that's the 2nd option than people might add custom controllers in their modules that reuse these front names and rely on this behavior.
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.
@ThijsFeryn @peterjaap any updates?
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.
@peterjaap this is your domain, can you provide an answer to @ihor-sviziev please?
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.
@ihor-sviziev here:
$this->setHeader('cache-control', 'no-store, no-cache, must-revalidate, max-age=0', true); $response->setHeader('Cache-Control', 'no-store');
Co-authored-by: Thijs Feryn <[email protected]>
Hello @peterjaap @ThijsFeryn @IvanChepurnyi, As I have gone through with the PR, It seems that it is still in development. So please let us know if it is ready for review. Thanks |
@engcom-Hotel I guess we're still waiting for @cpartica to take a look at the GraphQL part |
Thanks @peterjaap for the reply! @cpartica As @peterjaap mentioned here, we request you to please review it. Till the time we are moving this PR in draft status. Thanks |
@peterjaap consider to remove "no-store" from response header on cacheable pages to allow browsers caching the content and send validation request only for repeated visits. |
@peterjaap: it looks like there are merge conflicts, caused by these recent changes: 4f23095#diff-09a0a5ee7d8c56ee87cac97b0f291d7e416a810510d2719cdff73be3b3785740 (recent you may ask because the commit date is pretty old, but it looks like the commit was only merged 6 days ago) Can you try to figure out how to solve these conflicts in this PR? Thanks! |
@ThijsFeryn I remember you talking about collapsing during our call, could you take a look at this? 4f23095#diff-09a0a5ee7d8c56ee87cac97b0f291d7e416a810510d2719cdff73be3b3785740 |
@ThijsFeryn another question, I ran into this customized VCL: https://gist.github.com/henkvalk/f3b1cee66c1daf65b69630a01b8b096e It uses |
@peterjaap Running It's tricky to depend on this VMOD. Until we decide to package it officially, I recommend using bans. |
Hello @peterjaap @ThijsFeryn, Are we ready to pick this PR for review? As I can see the PR is in a conflict state. So I request you to please resolve the conflict. Thanks |
Thank you for your contribution! As per #36796 (comment) comment, in order to move further with this PR, resolving conflicts is necessary. Can you please look into them? Till then we are closing this PR. Please feel free to reopen or let us know when you are ready to work on it again, and we will be happy to re-open it. Thank you! |
Can we try and get this merge conflict resolved, it would be a shame to let all your work get undone. 4f23095#diff-09a0a5ee7d8c56ee87cac97b0f291d7e416a810510d2719cdff73be3b3785740 This commit makes sure that discounted prices do not get cached and shown to logged out users when the "X-Magento-Vary" cookie gets removed from the client. The way to reproduce this:
Without the fix: With the fix: I'm not sure if the way that it's currently implemented is the best way of avoiding it, but we can apply the same fix to your optimized VCL. |
This is a draft PR created in cooperation with @ThijsFeryn from Varnish Software and @IvanChepurnyi to optimize Magento's built in VCL. We will update the PR later on to explain why we made certain decisions.