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:

Cache-Control:public, s-maxage=300
Via:1.1 varnish-v4
X-Varnish:1737663 852286

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 and X-Url headers in vcl_backend_response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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