<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Varnish will do that by default. If you get a 503 from Varnish, it is because your VCL returns that or because your backend violates the HTTP protocol.<br>
<br>
As always: Show us varnishlog and we will be able to tell.<br>
<br>
--<br>
Andreas<br></blockquote><div><br></div><div>Thanks for responding, let me give you a live example so you can understand clearer : )</div><div><br></div><div>1. User -> Backend (<a href="http://b.kelvinloke.com">b.kelvinloke.com</a>). Backend returns HTTP 400 with body "Missing fromDate query string.", which is good.</div><div><br></div><div>2. User -> Varnish (<a href="http://v.kelvinloke.com">v.kelvinloke.com</a>) -> Backend. Varnish removes Backend's error body, replace with Varnish's generic error body.</div><div><br></div><div>My goal is to make Varnish to show Backend's error body, not Varnish's generic error body, which I have a difficult time to figure it out. I actually tried below but Varnish doesn't allow me to reload the config, with error "Running VCC-compiler failed, exited with 2" on resp.body variable.</div><div><br></div><div><div><font color="#333333">sub vcl_synth {</font></div><div><font color="#333333"> if (resp.status == 400) {</font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span>set resp.body = {"<!DOCTYPE html></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span><html></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span> <head></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span> </head></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span> <body></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span>"} + resp.body + {"</font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span> </body></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span></html></font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span>"};</font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span>return (deliver);</font></div><div><font color="#333333"><span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><font color="#333333">}</font></div></div><div><br></div><div>Here you go for the varnishlog if it helps.</div><div><br></div><div><div>- Begin bereq 34174473 pass</div><div>- Timestamp Start: 1469062408.399294 0.000000 0.000000</div><div>- BereqMethod GET</div><div>- BereqURL /</div><div>- BereqProtocol HTTP/1.1</div><div>- BereqHeader host: <a href="http://v.kelvinloke.com">v.kelvinloke.com</a></div><div>- BereqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8</div><div>- BereqHeader Accept-Language: en-US,en;q=0.8</div><div>- BereqHeader Cache-Control: no-cache</div><div>- BereqHeader Pragma: no-cache</div><div>- BereqHeader Upgrade-Insecure-Requests: 1</div><div>- BereqHeader User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36</div><div>- BereqHeader X-Forwarded-Port: 80</div><div>- BereqHeader X-Forwarded-Proto: http</div><div>- BereqHeader X-Forwarded-For: 190.112.230.244, 172.31.1.229</div><div>- BereqHeader True-Client-IP: 190.112.230.244</div><div>- BereqHeader Accept-Encoding: gzip</div><div>- BereqHeader X-Varnish: 34174474</div><div>- VCL_call BACKEND_FETCH</div><div>- VCL_return fetch</div><div>- BackendOpen 40 928d2c0c-8e82-4cdc-a194-b6ad0f14e051.kelvin 54.65.82.174 80 172.31.8.52 40796</div><div>- BackendStart 54.65.82.174 80</div><div>- Timestamp Bereq: 1469062408.401388 0.002093 0.002093</div><div>- Timestamp Beresp: 1469062408.403494 0.004200 0.002107</div><div>- BerespProtocol HTTP/1.1</div><div>- BerespStatus 400</div><div>- BerespReason Bad Request</div><div>- BerespHeader Server: nginx/1.6.2</div><div>- BerespHeader Date: Thu, 21 Jul 2016 00:43:01 GMT</div><div>- BerespHeader Content-Type: text/html</div><div>- BerespHeader Content-Length: 31</div><div>- BerespHeader Connection: close</div><div>- BerespHeader ETag: "579014ce-1f"</div><div>- TTL RFC -1 10 -1 1469062408 1469062408 1469061781 0 0</div><div>- VCL_call BACKEND_RESPONSE</div><div>- BerespUnset ETag: "579014ce-1f"</div><div>- TTL VCL 120 10 0 1469062408</div><div>- VCL_return deliver</div><div>- Storage malloc Transient</div><div>- ObjProtocol HTTP/1.1</div><div>- ObjStatus 400</div><div>- ObjReason Bad Request</div><div>- ObjHeader Server: nginx/1.6.2</div><div>- ObjHeader Date: Thu, 21 Jul 2016 00:43:01 GMT</div><div>- ObjHeader Content-Type: text/html</div><div>- ObjHeader Content-Length: 31</div><div>- Fetch_Body 3 length stream</div><div>- BackendClose 40 928d2c0c-8e82-4cdc-a194-b6ad0f14e051.kelvin</div><div>- Timestamp BerespBody: 1469062408.403543 0.004249 0.000049</div><div>- Length 31</div><div>- BereqAcct 528 0 528 171 31 202</div></div><div><div>- End</div><div><br></div><div>* << Request >> 34174473</div><div>- Begin req 34174464 rxreq</div><div>- Timestamp Start: 1469062408.399251 0.000000 0.000000</div><div>- Timestamp Req: 1469062408.399251 0.000000 0.000000</div><div>- ReqStart 172.31.1.229 32033</div><div>- ReqMethod GET</div><div>- ReqURL /</div><div>- ReqProtocol HTTP/1.1</div><div>- ReqHeader host: <a href="http://v.kelvinloke.com">v.kelvinloke.com</a></div><div>- ReqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8</div><div>- ReqHeader Accept-Encoding: gzip, deflate, sdch</div><div>- ReqHeader Accept-Language: en-US,en;q=0.8</div><div>- ReqHeader Cache-Control: no-cache</div><div>- ReqHeader Pragma: no-cache</div><div>- ReqHeader Upgrade-Insecure-Requests: 1</div><div>- ReqHeader User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36</div><div>- ReqHeader X-Forwarded-For: 190.112.230.244</div><div>- ReqHeader X-Forwarded-Port: 80</div><div>- ReqHeader X-Forwarded-Proto: http</div><div>- ReqHeader Connection: keep-alive</div><div>- ReqUnset X-Forwarded-For: 190.112.230.244</div><div>- ReqHeader X-Forwarded-For: 190.112.230.244, 172.31.1.229</div><div>- VCL_call RECV</div><div>- ReqHeader True-Client-IP: 190.112.230.244</div><div>- ReqUnset Accept-Encoding: gzip, deflate, sdch</div><div>- ReqHeader Accept-Encoding: gzip</div><div>- VCL_return pass</div><div>- VCL_call HASH</div><div>- VCL_return lookup</div><div>- VCL_call PASS</div><div>- VCL_return fetch</div><div>- Link bereq 34174474 pass</div><div>- Timestamp Fetch: 1469062408.403541 0.004290 0.004290</div><div>- RespProtocol HTTP/1.1</div><div>- RespStatus 400</div><div>- RespReason Bad Request</div><div>- RespHeader Server: nginx/1.6.2</div><div>- RespHeader Date: Thu, 21 Jul 2016 00:43:01 GMT</div><div>- RespHeader Content-Type: text/html</div><div>- RespHeader Content-Length: 31</div><div>- RespHeader X-Varnish: 34174473</div><div>- RespHeader Age: 0</div><div>- RespHeader Via: 1.1 varnish-v4</div><div>- VCL_call DELIVER</div><div>- RespUnset Via: 1.1 varnish-v4</div><div>- RespUnset Server: nginx/1.6.2</div><div>- RespUnset X-Varnish: 34174473</div><div>- VCL_return synth</div><div>- Timestamp Process: 1469062408.403549 0.004297 0.000008</div></div><div><div>- Timestamp Process: 1469062408.403551 0.004300 0.000002</div><div>- RespHeader Date: Thu, 21 Jul 2016 00:53:28 GMT</div><div>- RespHeader Server: Varnish</div><div>- RespHeader X-Varnish: 34174473</div><div>- RespProtocol HTTP/1.1</div><div>- RespStatus 400</div><div>- RespReason Bad Request</div><div>- RespReason Bad Request</div><div>- VCL_call SYNTH</div><div>- RespHeader Content-Type: text/html; charset=utf-8</div><div>- RespHeader Retry-After: 5</div><div>- VCL_return deliver</div><div>- RespHeader Content-Length: 258</div><div>- Storage malloc Transient</div><div>- Debug "RES_MODE 2"</div><div>- RespHeader Connection: keep-alive</div><div>- Timestamp Resp: 1469062408.403587 0.004336 0.000036</div><div>- ReqAcct 499 0 499 204 258 462</div><div>- End</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div></div>