varnishncsa %s in backend mode: 304 logged as 200

Rainer Canavan rainer.canavan+varnish at sevenval.com
Thu Oct 31 17:14:24 UTC 2019


On Thu, Oct 31, 2019 at 5:48 PM Guillaume Quintard <
guillaume at varnish-software.com> wrote:
>
> Hi,
>
> Varnish automatically transforms the 304 response into the object it
represents, this is why you are seeing the 200 (but it could be pretty much
any status that you are revalidating).
> If you want to check for 304s, you can do something like this:
>
> sub vcl_backend_response {
>     if (beresp.was_304) {
>         std.log("true_status: 304");
>     } else {
>         std.log("true_status: " + beresp.status);
>     }
> }
>
> and then use %{VSL:VCL_Log:true_status}x in the varnishncsa format line
to retrieve it

Thanks, that construct logs exactly what I wanted.

Rainer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20191031/80f25767/attachment.html>


More information about the varnish-misc mailing list