<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div style="" class=""><span class="" style="font-size: 13px;">To answer my own question,</span></div><div style="" class=""><span style="font-size: small;" class=""><br class="" style=""></span></div><div class="" style=""><span class="" style="font-size: small;"></span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class="">I got this to work by using valid <span id="misspell-0" class="" style="">http</span> codes in <span id="misspell-1" class="" style="">synth</span>() call. </span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br class="" style=""></div><div class=""
style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">>>>>>>>>>></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br class="" style=""></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">sub vcl_recv {</div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br class="" style=""></div><div class="" style="background-color:
transparent;"><span style="font-size: 13px;" class=""> if (req.url ~ "^/ping") {</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> return (synth(200, "OK"));</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> }</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><span style="font-size: 13px;" class=""><br class="" style=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><span style="font-size: 13px;" class="">}</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><span style="font-size: 13px;" class=""><br class="" style=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">sub vcl_synth {</div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br class="" style=""></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> if (resp.status == 200) {</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> if </span><span style="font-size: 13px;
background-color: transparent;">(req.url ~ "^/ping") {</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> synthetic("pong");</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> }</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> set resp.http.Content-Type = "text/plain; charset=utf-8";</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> return (deliver);</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""> }</span></div><div class="" style="background-color: transparent;"><span style="font-size: 13px;" class=""><br class="" style=""></span></div><div class="" style="background-color: transparent;"><span style="font-size:
13px;" class="">}</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><<<<<<<<<<<<</div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">No more calls to backend and varnish returns
the synthetic response right away.</div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">thanks,</div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">Madhu</div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px;
font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;">ps: please pardon typos in code if any</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" class=""> <div dir="ltr" class="" style=""> <font size="2" face="Arial" class="" style=""> On Tuesday, September 9, 2014 9:38 PM, Madhusudan Ramanna <m.ramanna@ymail.com> wrote:<br class="" style=""> </font> </div> <br class="" style=""><br class="" style=""> <div class="" style=""><div id="yiv3270110225" class="" style=""><div class="" style=""><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica
Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;" class=""><div class="" style="">Hello, </div><div class="" style=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">We're using 3.0.5 in production and currently testing 4.0.1. </div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">We
have some urls for which we always construct synthetic responses. (/ping response pong)</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">In 4.x vcl, I'm matching against the req url and returning synth with appropriate error code.</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif;font-style:normal;background-color:transparent;" class="">>>>>>>>>>>>>>>></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="background-color:transparent;" class="">sub vcl_recv {</div><div style="background-color:transparent;" class=""> if (req.url ~ "^/ping") {</div><div style="background-color:transparent;" class=""> return (synth(1002, "OK"));</div><div style="background-color:transparent;" class=""> }</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0,
0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="background-color:transparent;" class="">sub vcl_synth {</div><div style="background-color:transparent;" class=""><br class="" style=""></div><div style="background-color:transparent;" class=""> if (resp.status == 1002) {</div><div style="background-color:transparent;" class=""> set resp.status = 200;</div><div style="background-color:transparent;" class=""> set resp.http.Content-Type = "text/plain; charset=utf-8";</div><div style="background-color:transparent;" class=""> synthetic("pong");</div><div style="background-color:transparent;" class=""> return (deliver);</div><div style="background-color:transparent;" class="">
}</div><div style="background-color:transparent;" class=""><br class="" style=""></div><div style="background-color:transparent;" class="">}</div><div style="background-color:transparent;" class=""><<<<<<<<<<<<<<<<<</div><div style="background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">However, when the backend is down, varnish does not return the synthetic response</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="background-color:transparent;" class="">< HTTP/1.1 503 OK</div><div style="background-color:transparent;" class="">< Date: Wed, 10 Sep 2014 04:31:40 GMT</div><div style="background-color:transparent;" class="">< Server: Varnish</div><div style="background-color:transparent;" class="">< X-Varnish: 35</div><div style="background-color:transparent;" class="">< Content-Length: 0</div><div style="background-color:transparent;" class="">< Connection: keep-alive</div><div style="background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">Here is the varnishlog</div><div style="color:rgb(0, 0,
0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="background-color:transparent;" class="">- ReqHeader Host: localhost:6081</div><div style="background-color:transparent;" class="">- ReqHeader Accept: */*</div><div style="background-color:transparent;" class="">- ReqHeader X-Forwarded-For: 127.0.0.1</div><div style="background-color:transparent;" class="">- VCL_call RECV</div><div style="background-color:transparent;" class="">- Debug "VCL_error(1002, OK)"</div><div style="background-color:transparent;" class="">- VCL_return synth</div><div style="background-color:transparent;" class="">-
VCL_call HASH</div><div style="background-color:transparent;" class="">- VCL_return lookup</div><div style="background-color:transparent;" class="">- Timestamp Process: 1410309978.983313 0.000075 0.000075</div><div style="background-color:transparent;" class="">- RespHeader Date: Wed, 10 Sep 2014 00:46:18 GMT</div><div style="background-color:transparent;" class="">- RespHeader Server: Varnish</div><div style="background-color:transparent;" class="">- RespHeader X-Varnish: 32797</div><div style="background-color:transparent;" class="">- RespProtocol HTTP/1.1</div><div style="background-color:transparent;" class="">- RespStatus 503</div><div style="background-color:transparent;" class="">- RespReason Service Unavailable</div><div
style="background-color:transparent;" class="">- RespReason OK</div><div style="background-color:transparent;" class="">- VCL_call SYNTH</div><div style="background-color:transparent;" class="">- VCL_return deliver</div><div style="background-color:transparent;" class="">- RespHeader Content-Length: 0</div><div style="background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">Not sure why the thread would call HASH. I would expect varnish to
deliver the response after the vcl_synth call ?</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">Is this the expected behavior ? How can I fix this to return synthetic response without regard for the health of the backend</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif;font-style:normal;background-color:transparent;" class="">appreciate your response !</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">thank you,</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;"
class="">Madhu</div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class="">ps: <span style="font-size:10pt;background-color:transparent;" class="">Also looking forward to 4.x version of Varnish book </span></div><div class="" style=""><span style="font-size:10pt;background-color:transparent;" class=""><br class="" style=""></span></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div><div style="color:rgb(0, 0,
0);font-size:13px;font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-style:normal;background-color:transparent;" class=""><br class="" style=""></div></div></div></div><br class="" style="">_______________________________________________<br class="" style="">varnish-misc mailing list<br class="" style=""><a ymailto="mailto:varnish-misc@varnish-cache.org" href="mailto:varnish-misc@varnish-cache.org" class="" style="">varnish-misc@varnish-cache.org</a><br class="" style=""><a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank" class="" style="">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br class="" style=""><br class="" style=""></div> </div> </div> </div> </div></body></html>