I am attempting to manage cache invalidation by using cache tags in a header field called X-Cache-Tags. The relevant headers from a typical response look like this:
Age:218
Cache-Control:public, s-maxage=300
Via:1.1 varnish-v4
X-Cache-Tags:product-395378,brand-54,product-374977,product-419381,product-184166,product-419380,category-974
X-Varnish:1737663 852286
X-Varnish-Cache:HIT
This object is cached correctly and I get hits when I request the page.
I am also able to issue a ban on these headers. After issuing the ban for the tag product-395378
, my ban.list looks like this:
1435166652.596926 117 obj.http.X-Host ~ .* && obj.http.X-Url ~ .* && obj.http.content-type ~ .* && obj.http.X-Cache-Tags ~ (product\-395378)(,.+)?$
So it looks like the ban is set correctly. However, when I request this same page after the ban, the cache is not invalidated and I get a cache hit instead of a miss.
What could be the issue?
I found the issue. I was not setting the
X-Host
andX-Url
headers in vcl_backend_response.