Question regarding vcl config

Johan Hendriks neuteboom.log at gmail.com
Sat Sep 26 16:39:30 UTC 2020


Hello all, I have inherited a varnish server. And I am a little confused
about a few lines in that config.

It has the following in vcl_recv

    # Don't cache if there are request cookies
    if (req.http.Cookie) {
        set req.http.X-Debug-Varnish-Nocache-Recv = "Got request cookie ("
+ req.http.Cookie + ")";

        return (pass);
    }

    if (req.url ~
"\.(png|gif|jpg|jpeg|ico|swf|css|js|pdf|ico|js|ogg|mp4)$") {
        unset req.http.cookie;
    }
    if (req.url ~ "^/(includes|images|templates)") {
        unset req.http.cookie;
    }

So the first if block tells request with req.http.Cookie to pass to the
backend.
The second tells if the requested url ends with
.png|gif|jpg|jpeg|ico|swf|css|js|pdf|ico|js|ogg|mp4 and so on to unset the
cookie.
But will these rules be executed or is the request already passed to the
backend?

Thanks for your time
regards
Neuteboom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20200926/8300f546/attachment.html>


More information about the varnish-misc mailing list