See what is passing though the varnish proxy without a log

First add a header to see what is going on in the varnish proxy

vcl 4.0;
 
sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
        if (obj.hits > 0) {
                set resp.http.X-Cache = "HIT";
        } else {
                set resp.http.X-Cache = "MISS";
        }
}

No we can us varnishlog to see what urls are passing as a miss!

varnishlog -q ‘RespHeader ~ “X-Cache: MISS”‘ | grep -i requrl

Comments are closed.