I'm trying to setup ban in Varnish 4.
I have this in vcl_recv :
ban("req.http.host == " +req.http.host+" && req.url ~ "+req.url);
return(synth(200, "Ban added"));
When I make a request, it does say ban added, and I do see it un the ban.list with varnishadm :
1499676469.672070 0 req.http.host == something.com && req.url ~ /some/path?q=*
Except it doesn't work, nothing gets invalidated.
If I try to ban path* it seems to apply to "regular" files like path.css for example, but it looks like it never invalidates URLs based on query string.
Is there something else I need to do to get it to consider the query string ?
The query strings are pretty unreadable, full of % codes, if that matters.
Thanks
Best Answer
I think you're looking for
PURGE
instead. It will be more effective, and will invalidate whatever URL you request in PURGE request. Invcl_recv
, add:Next, invalidate a page from cache:
If you really want
BAN
s instead (do you really have to?), then don't use REGEX matching (~
) to invalidate specific URLs, since it will more than likely interpret?
and other query parameters as engine flags. So: