I have this magento store I just installed and configured according to guides Varnish cache.

Website now is blazing fast, but if I update a product (for example, add a description), even if I cache clean/flush, invalidate indexes and reindex, product page still shows stale data (ie none of the changes I just made).

How can I make sure that, anytime I update a product, I either invalidate/redo the cache for that product?

  • did you try to purge Varnish? find a way to purge Varnish. Commented Jan 30, 2021 at 4:28
  • have you configured the varnish acl correctly specifically acl purge list? Saving a product should always invalidate the varnish cache for that product.
    – paj
    Commented Jan 30, 2021 at 11:26
  • If I post my /etc/varnish/default.vcl can you help me understand if I did it right, @paj?
    – Odin
    Commented Jan 30, 2021 at 13:54
  • When you load the page, open your js console and click on the "network" tab. Look for the entry which is the page (not images, js files, etc). Usually the first entry in the list but you can also use the "Doc" filter to find it. Check the response headers and see if the cache headers not HIT or MISS Commented Jan 31, 2021 at 7:35

1 Answer 1


Ban & purge

The standard Magento VCL configuration has logic inside the vcl_recv subroutine to invalidate the cache. This uses the ban VCL function.

Here's an extract:

if (req.http.host && req.http.host != "" && req.http.host != "") {
    ban("obj.http.X-Host ~ " + req.http.host + " && obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
} else {
    ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);} 

When changes are made in your backend, and a ban is triggered, you can run the following command to display the so-called ban list:

varnishadm ban.list

This will list all attempts to ban content from the cache, and it uses ban expressions to match patterns of objects.

Please check the ban list. When in doubt, share ban list entries immediately after changing content in the Magento backend. This will allow me to judge whether or not something was wrong.

Debug using the Age header

If it turns out that a ban was successful, the matching objects wil be removed from cache. The Age response header reflects the age of objects in cache.

A successful ban will result in an Age: 0 header. Please look out for this

Debug using varnishlog

The varnishlog utility is an in-depth logging tool that gives you insight in what happens to each request.

Run the following command for the page you want to monitor:

varnishlog -g request -q "ReqUrl eq '/'"

Then update some product settings in your backend, and then open the page again. You'll see how Varnish behaves by looking at the logs.

You can also monitor the effectiveness of the ban itself by running the following command:

varnishlog -g request -q "ReqMethod eq 'PURGE'"

The logs will also be quite explicit on what happened to the ban.

When you're having a tough time interpreting the output of these logs, have a look at the blog post I wrote about varnishlog: https://feryn.eu/blog/varnishlog-measure-varnish-cache-performance/

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.