-
Notifications
You must be signed in to change notification settings - Fork 461
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
Support Netlify-Vary header in netlify v2 preset #2431
Comments
@serhalp do you have any insights on the situation? |
Hey @Rigo-m, thanks for writing this up. Isn't a |
In the "no-cdn-cache-control" branch you can see that I've set the routeRule for caching the page here, using the new netlify v2 preset.
Setting |
Thanks for clarifying @Rigo-m – I'm with you now. I think I see where the regression is coming from. I'll have a PR up soon. |
Amazing, left a small comment for you there |
Environment
See reproduction.
Relevant branches:
https://github.com/Rigo-m/netlify-v2-repro/tree/no-cdn-cache-control
https://github.com/Rigo-m/netlify-v2-repro/tree/cdn-cache-control
Check route rules.
Reproduction
https://cache-key-variations.netlify.app/guess?value=2 you can see how this page gets cached at the edge, including the variation on the value query parameter (take a look specifically at the Netlify-Vary heade, the Cdn-Cache-Control header and the Age header for verification).
Here: https://no-cdn-cache-control--netlify-v2-nitro.netlify.app/?page=3 you can see that while the Netlify-Vary header is present, it's not actually caching the page.
Here: https://cdn-cache-control--netlify-v2-nitro.netlify.app/?page=3 you can see that by adding the Cdn-Cache-Control header everything works accordingly.
Describe the bug
Netlify v2 preset appends a Netlify-Cdn-Cache-Control header to instruct the netlify edge platform on how to handle CDN caching.
Only setting this header makes the edge network ignore the Netlify-Vary header (somehow).
We should send the Cdn-Cache-Control header as well, so that when setting the additional header Netlify-Vary from routeRules works accordingly without handling other headers.
Additional context
I'll drop two PRs after #2425 gets merged, one with the relevant fix, another with relevant documentation on the Netlify-Vary header for the netlify v2 preset :)
Logs
No response
The text was updated successfully, but these errors were encountered: