Labels and purge scope

Adrien Bigot adrien.bigot at smile.fr
Thu Dec 19 15:06:25 UTC 2019


Hello,

I plan to use labels on a Varnish stack in front of multiple backends.
I have a question about ban with multiple labels.

My main.vcl will route requests in function of Host header for example
like this :

if (req.http.host == "front.mydomain.com") {
      return (vcl(l_varnish_fronts));
    }
    if (req.http.host == "api.mydomain.com") {
      return (vcl(l_varnish_api));
    }


When we want to ban objects we do it with a HTTP BAN method on each
varnish server. Varnish handle it the BAN request like that  in each
label's VCL file :
sub vcl_recv {
        if (req.method == "BAN") {

        if (req.http.Cache-BanExpression) {
            ban(req.http.Cache-BanExpression);
        }
        return (synth(200, "Banned"));
}


My question is if I want to purge contents like this :

curl -XBAN --header 'Cache-BanExpression:
obj.http.Cache-Tags-TeamCompetitionReference ~ (^|,)6847(,|$)'  
http://myVarnishIP

Will them be banned for all my Labels (if I include the proper vcl code
in main.vcl), or do I have to make a request for each label like :
curl -XBAN --header 'Host: front.mydomain.com' --header
'Cache-BanExpression: obj.http.Cache-Tags-TeamCompetitionReference ~
(^|,)6847(,|$)'   http://myVarnishIP
curl -XBAN --header 'Host: api.mydomain.com'    --header
'Cache-BanExpression: obj.http.Cache-Tags-TeamCompetitionReference ~
(^|,)6847(,|$)'   http://myVarnishIP


In fact, I want to know if the cache is mutualized between labels ? If
yes, is a solution exists to purge contents in all labels without
sending multiple BAN requests ?

Thanks in advance.

Best regards,

-- 

Adrien Bigot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20191219/6999d109/attachment-0001.html>


More information about the varnish-misc mailing list