Using *BAN*, is it possible to invalidate a particular variant of a varnish cache?
We use locale in http vary header to keep different variants of the cache, but the *BAN* configured is invalidating all the cache. *BAN configuration * sub vcl_backend_response { set beresp.http.x-ban-locale = bereq.http.X-BOLT-SITE-LOCALE; set beresp.http.x-url = bereq.url; } sub vcl_deliver { unset resp.http.x-ban-locale; unset resp.http.x-url; } sub vcl_recv { if (req.method == "BAN") { if(req.http.x-ban-regex) { ban("obj.http.x-ban-locale == " +req.http.X-BOLT-SITE-LOCALE +" && obj.http.x-url ~ "+req.http.x-ban-regex); } else { ban("obj.http.x-ban-locale == " +req.http.X-BOLT-SITE-LOCALE +" && obj.http.x-url == "+req.url); } return(synth(200, "Ban Added")); } } *CURL command to add the BAN* curl -v -XBAN -H 'x-ban-regex:^/boltapi/v1/ads*(\?.*)*$' -H 'X-BOLT-SITE-LOCALE:en_ZA' -H 'Vary:en_ZA' {hostname}:{port}
_______________________________________________ varnish-dev mailing list varnish-dev@varnish-cache.org https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev