I have Varnish 6.4 set up with Magento 2.4.2 in Kubernetes, and can confirm it is set up correctly by the "x-magento-cache-debug HIT" header. However, when I update a product, the product page isn't updating, presumably it is serving the cached old product page. Is there something I have to set up in Magento to get it to inform Varnish when a product etc has updated?
1 Answer 1
As per the official documentation, Varnish is purged automatically when you perform the below actions.
Maintaining a store (for example, adding or editing categories, prices, products, and promotional pricing rules).
I guess you missed the steps Configure Magento to purge Varnish . If you missed this step, Magento cache clean/flush will fail to purge the cache from varnish. Run the below command, it will configure Magento to purge the Varnish cache.
php bin/magento setup:config:set --http-cache-hosts=varnish-host:varnish-port
I hope it helps.
- 
 
- 
 Thanks, this helped. I had already used this command yesterday, but it turns out that my purge requests were 405ing due to my VCL configuration, which I worked out by using: varnishlog -g request -q 'ReqMethod eq "PURGE"'mahgo– mahgo2021年05月25日 01:06:49 +00:00Commented May 25, 2021 at 1:06
Explore related questions
See similar questions with these tags.