<div dir="ltr">Hi,<div><br></div><div>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).</div><div>If you want to check for 304s, you can do something like this:</div><div><br></div><div>sub vcl_backend_response {</div><div> if (beresp.was_304) {</div><div> std.log("true_status: 304");</div><div> } else {</div><div> std.log("true_status: " + beresp.status);</div><div> }</div><div>}</div><div><br></div><div>and then use %{VSL:VCL_Log:true_status}x in the varnishncsa format line to retrieve it</div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 31, 2019 at 9:17 AM Rainer Canavan <<a href="mailto:rainer.canavan%2Bvarnish@sevenval.com">rainer.canavan+varnish@sevenval.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
we want to get a better understanding how well our varnish setup is<br>
performing. We've got two varnishncsa running, one with '-b' and one<br>
without, and each with their own logformat configuration. Each of<br>
those configurations contains "status":%s. Varnish version is<br>
varnish-6.2.1.<br>
<br>
If varnish successfully revalidates a stored response, i would expect<br>
the backend log to show a status of 304, and the client log a status<br>
of 200, but in reality, the vanishncsa running with "-b" also reports<br>
a status of 200.<br>
<br>
Just to make sure, I've watched with tcpdump what's going on, and<br>
varnish does really receive a 304 from the backend. The client sends<br>
<br>
GET /test/5db010a2-07a5-4119-b90b-ed7328c42231 HTTP/1.1<br>
Host: cachetest.backend<br>
[...]<br>
<br>
and receives from varnish:<br>
<br>
HTTP/1.1 200 OK<br>
Cache-Control: max-age=3600<br>
Date: Thu, 31 Oct 2019 14:43:19 GMT<br>
Etag: "ASKCUMEWOGYQIAS"<br>
[...]<br>
<br>
The same request between varnish and the backend:<br>
<br>
GET /test/5db010a2-07a5-4119-b90b-ed7328c42231 HTTP/1.1<br>
Host: cachetest.backend<br>
If-None-Match: "ASKCUMEWOGYQIAS"<br>
[...]<br>
<br>
HTTP/1.1 304 Not Modified<br>
Cache-Control: max-age=3600<br>
Date: Thu, 31 Oct 2019 14:43:19 GMT<br>
Etag: "ASKCUMEWOGYQIAS"<br>
Connection: close<br>
<br>
Is there another statement for the varnishncsa log format that shows<br>
the "real" backend HTTP status? Does this work as intended, or is this<br>
a bug?<br>
<br>
Rainer<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>