<div dir="ltr">please keep the mailing-list in the loop<div><br clear="all"><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 Tue, Sep 3, 2019 at 2:51 PM Tim Kelty <<a href="mailto:timkelty@gmail.com">timkelty@gmail.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">
<div>
<div name="messageBodySection">
<div dir="auto">Thanks <span style="color:rgb(9,20,57);font-family:"Helvetica Neue"">Guillaume,</span>
<div dir="auto"><br></div>
<div dir="auto">Makes sense about bypassing the built-in synth…and the 0-length body.</div>
<div dir="auto">Looking at the first line of the response, I can see something like this (still no reason after 200):</div>
<div dir="auto"><br></div>
<blockquote style="margin:5px;padding-left:10px;border-left:thin solid rgb(26,188,156)" class="gmail-m_7098675303203673720spark_quote">
<div dir="auto">❯ curl -I -X "PURGE" -H "XKEY-PURGE:el30" <a href="https://site.com" target="_blank">https://site.com</a></div>
<div dir="auto">HTTP/2 200</div>
<div dir="auto">accept-ranges: bytes</div>
<div dir="auto">date: Tue, 03 Sep 2019 12:33:14 GMT</div>
<div dir="auto">server: Varnish</div>
<div dir="auto">x-varnish: 721122</div>
<div dir="auto">content-length: 0</div>
</blockquote>
<div dir="auto"><br></div>
<div dir="auto">So what should I return to include the reason in the response?</div>
<div dir="auto">I think my vcl_synth example came from: <a href="https://github.com/mattiasgeniar/varnish-5.0-configuration-templates/blob/master/default.vcl#L381-L397" target="_blank">https://github.com/mattiasgeniar/varnish-5.0-configuration-templates/blob/master/default.vcl#L381-L397</a></div>
<div dir="auto"><br></div>
<div dir="auto">Thanks again for the help!</div>
</div>
</div>
<div name="messageSignatureSection"><br>
<div class="gmail-m_7098675303203673720matchFont">—<br>
Tim Kelty<br></div>
</div>
<div name="messageReplySection">On Aug 29, 2019, 3:18 PM -0400, Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>>, wrote:<br>
<blockquote type="cite" class="gmail-m_7098675303203673720spark_quote" style="margin:5px;padding-left:10px;border-left:thin solid rgb(26,188,156)">
<div dir="ltr">because you return deliver, you are bypassing the builtin.vcl section that usually calls synthetic() (<a href="https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishd/builtin.vcl#L113" target="_blank">https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishd/builtin.vcl#L113</a>), that is why you have a 0-length body.
<div><br></div>
<div>Also, the "Invalidated..." message is the reason (like the "OK" for a 200), not the body. Check the response line of your response (i.e. the first line, before the headers)</div>
<div><br clear="all">
<div>
<div dir="ltr" class="gmail-m_7098675303203673720gmail_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, Aug 29, 2019 at 11:38 AM Tim Kelty <<a href="mailto:timkelty@gmail.com" target="_blank">timkelty@gmail.com</a>> wrote:<br></div>
<blockquote class="gmail_quote gmail-m_7098675303203673720spark_quote" style="margin:5px;padding-left:10px;border-left:thin solid rgb(230,126,34)">
<div>
<div name="messageBodySection">
<div dir="auto">Within my vcl_recv, I have something like this:
<div dir="auto"><br></div>
<div dir="auto"><br></div>
<div dir="auto">
<div style="color:rgb(204,204,204);background-color:rgb(45,45,45);font-size:18px;line-height:27px;white-space:pre-wrap">
<div><span style="color:rgb(153,153,153)"># Allow purging</span></div>
<div><span style="color:rgb(204,153,204)">if</span> (<span style="color:rgb(242,119,122)">req.method</span> == <span style="color:rgb(153,204,153)">"PURGE"</span>) {</div>
<div><span style="color:rgb(204,153,204)">if</span> (!<span style="color:rgb(242,119,122)">client.ip</span> ~ <span style="color:rgb(102,153,204)">purge</span>) {</div>
<div><span style="color:rgb(204,153,204)">return</span> (<span style="color:rgb(249,145,87)">synth</span>(403, "Forbidden"));</div>
<div>}</div>
<br>
<div><span style="color:rgb(204,153,204)">if</span> (<span style="color:rgb(242,119,122)">req.http.xkey-purge</span>) {</div>
<div><span style="color:rgb(204,153,204)">set</span> <span style="color:rgb(242,119,122)">req.http.n-gone</span> = xkey.<span style="color:rgb(102,153,204)">purge</span>(<span style="color:rgb(242,119,122)">req.http.xkey-purge</span>);</div>
<div><span style="color:rgb(153,153,153)"># If you got this stage (and didn't error out above), purge the cached result</span></div>
<div><span style="color:rgb(204,153,204)">return</span> (<span style="color:rgb(249,145,87)">synth</span>(200, "Invalidated "+req.http.n-gone+" objects"));</div>
<div>} <span style="color:rgb(204,153,204)">else</span> {</div>
<div><span style="color:rgb(204,153,204)">return</span> (<span style="color:rgb(249,145,87)">purge</span>);</div>
<div>}</div>
<br>
<div>}</div>
</div>
</div>
</div>
</div>
<div name="messageSignatureSection"><br>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto">…and a a vcl_synth like:</div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto"><br></div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto">
<div style="color:rgb(204,204,204);background-color:rgb(45,45,45);line-height:27px;white-space:pre-wrap">
<div><span style="color:rgb(204,153,204)">sub</span> vcl_synth {</div>
<div><span style="color:rgb(204,153,204)">if</span> (<span style="color:rgb(242,119,122)">resp.status</span> == <span style="color:rgb(249,145,87)">720</span>) {</div>
<div><span style="color:rgb(153,153,153)"># We use this special error status 720 to force redirects with 301 (permanent) redirects</span></div>
<div><span style="color:rgb(153,153,153)"># To use this, call the following from anywhere in vcl_recv: return (synth(720, "<a href="http://host/new.html" target="_blank">http://host/new.html</a>"));</span></div>
<div><span style="color:rgb(204,153,204)">set</span> <span style="color:rgb(242,119,122)">resp.http.Location</span> = <span style="color:rgb(242,119,122)">resp.reason</span>;</div>
<div><span style="color:rgb(204,153,204)">set</span> <span style="color:rgb(242,119,122)">resp.status</span> = <span style="color:rgb(249,145,87)">301</span>;</div>
<div><span style="color:rgb(204,153,204)">return</span> (<span style="color:rgb(249,145,87)">deliver</span>);</div>
<div>} <span style="color:rgb(204,153,204)">elseif</span> (<span style="color:rgb(242,119,122)">resp.status</span> == <span style="color:rgb(249,145,87)">721</span>) {</div>
<div><span style="color:rgb(153,153,153)"># And we use error status 721 to force redirects with a 302 (temporary) redirect</span></div>
<div><span style="color:rgb(153,153,153)"># To use this, call the following from anywhere in vcl_recv: return (synth(720, "<a href="http://host/new.html" target="_blank">http://host/new.html</a>"));</span></div>
<div><span style="color:rgb(204,153,204)">set</span> <span style="color:rgb(242,119,122)">resp.http.Location</span> = <span style="color:rgb(242,119,122)">resp.reason</span>;</div>
<div><span style="color:rgb(204,153,204)">set</span> <span style="color:rgb(242,119,122)">resp.status</span> = <span style="color:rgb(249,145,87)">302</span>;</div>
<div><span style="color:rgb(204,153,204)">return</span> (<span style="color:rgb(249,145,87)">deliver</span>);</div>
<div>}</div>
<br>
<div><span style="color:rgb(204,153,204)">return</span> (<span style="color:rgb(249,145,87)">deliver</span>);</div>
<div>}</div>
</div>
</div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto"><br></div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto"><br></div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto">When I perform the xkey-purge request, I get back a 200, and can confirm that the purging is working, but the content-length is always 0 (I don't get the "Invalidated n objects" message).</div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto"><br></div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto">Not sure where to start debugging…any idea what could cause this?</div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont" dir="auto"><br></div>
<div class="gmail-m_7098675303203673720gmail-m_-1709242024992442460matchFont">—<br>
Tim Kelty</div>
</div>
</div>
_______________________________________________<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>
</blockquote>
</div>
</div>
</blockquote></div>