Mailing List Archive

Re: BAN variant of varnish cache
(redirecting the response to varnish-misc, where the question would have belonged)

On 14/10/2019 16:13, Santosh Abraham wrote:
> Using *BAN*, is it possible to invalidate a particular variant of a varnish cache?

What you are trying to do should just work, and I cannot spot an error in your
VCL with regards to the ban handling.

But your use of the Vary header looks wrong, It is not a request header but
rather a response header (which you need to set in vcl_backend_response) and
also the value if the Vary header is the name of a request header.

So in your case it should be something like:

sub vcl_backend_response {
if (beresp.http.Vary) {
set beresp.http.Vary = beresp.http.Vary + ", X-BOLT-SITE-LOCALE"; } else { set beresp.http.Vary = "X-BOLT-SITE-LOCALE";
}
}

Nils