ezplatform-http-cache
ezplatform-http-cache copied to clipboard
Improvements to Varnish configuration
Hi, I'm happy to see you're using Varnish, but it seems the VCL configuration is a bit outdated.
I've made a few commits I hope will be helpful.
Summary:
- Varnish versions 5 and older are really not recommended for production anymore
- Grace/keep is automatically handled in Varnish 6, and when backends are healthy, I suggest to cap grace to serve fresh content.
- The official way to detect hit/miss in varnish, more info:
- https://docs.varnish-software.com/tutorials/hit-miss-logging/
- https://github.com/varnish/toolbox/tree/master/vcls/hit-miss)
- https://info.varnish-software.com/blog/using-obj-hits
- using vmod cookie for cookie handling is much more readable than regex, and more performant.
Lastly, I've added some simple varnishtest testcases, these can be ran with the varnishtest utility which comes in the same package as varnish, but it's most powerful when ran using the official docker image in CI. The tests I've added are just one for checking that the configuration is correct, compiles and passes one requet, and one for demonstrating cookie handling, but more advanced tests can be made, for example to test purging and caching of specific requests and responses.
Please let me know what you think, and if you have inputs to this I'm happy to make changes to make it better for you.
TODO:
- [ ] Ask for Code Review.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication