1

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

0

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.

2
  • Thanks, I'll try that out.
    – mahgo
    Commented May 24, 2021 at 8:26
  • 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
    Commented May 25, 2021 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.