We are using below code in Varnish 4.x:
if (req.http.X-Pool) {
ban("obj.http.X-Pool ~ " + req.http.X-Pool);
}
Now we are moving to Fastly which uses Varnish 2.x, so we are not getting what is the alternative to ban in Varnish 2.x
We are using below code in Varnish 4.x:
if (req.http.X-Pool) {
ban("obj.http.X-Pool ~ " + req.http.X-Pool);
}
Now we are moving to Fastly which uses Varnish 2.x, so we are not getting what is the alternative to ban in Varnish 2.x
For help with Fastly Varnish/VCL I recommend reading through both:
I would also generally recommend reaching out to [email protected] (they're a good group of people).
With regards to your question, I'm unfamiliar with
bansin standard Varnish, but reading through https://varnish-cache.org/docs/trunk/users-guide/purging.html#bans it suggests that a ban is a way to prevent cached content from being served.So the solution depends on what you're trying to achieve when that happens.
If you just want to avoid the cache you can return a
passfrom the various subroutines likevcl_recvandvcl_hit(although from vcl_hit will cause a hit-for-pass and so that will cause the request to go straight to the backend.You could also add custom logic to either
vcl_recvor maybe evenvcl_hit(if you want to be sure the content requested was actually cached) and from there you could trigger anerrorwhich would send you tovcl_errorwhere you could construct a synthetic response:Alternatively from either
vcl_recvorvcl_hityou might want torestartand then have a check for the restart and do something different (change the backend or the request in some way):