<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I am new to varnish. Whenever I am trying to acess our backend via varnish I am getting the below error:-<br><font size="1"><span style="font-family:monospace,monospace"><!DOCTYPE html><br><html><br>  <head><br>    <title>503 Backend fetch failed</title><br>  </head><br>  <body><br>    <h1>Error 503 Backend fetch failed</h1><br>    <p>Backend fetch failed</p><br>    <h3>Guru Meditation:</h3><br>    <p>XID: 3</p><br>    <hr><br>    <p>Varnish cache server</p><br>  </body><br></html><br><br></span></font></div><font size="1"><span style="font-family:monospace,monospace"><font face="arial,helvetica,sans-serif"><font size="2">My vcl looks like below:-<br></font></font>vcl 4.0;<br>backend default {<br>    .host = "146.88.25.40";<br>    .port = "8080";<br>}<font face="arial,helvetica,sans-serif"><font size="2"><br><br></font></font></span></font></div><font size="1"><span style="font-family:monospace,monospace"><font face="arial,helvetica,sans-serif"><font size="2">Directly requesting to the backend from the host in which varnish is installed works fine.<br><br></font></font></span></font></div><font size="1"><span style="font-family:monospace,monospace"><font face="arial,helvetica,sans-serif"><font size="2">I also tried setting </font></font></span></font><font size="1"><span style="font-family:monospace,monospace">.connect_timeout = 60s; first_byte_timeout = 60s;  .between_bytes_timeout = 60s; </span><font size="2"><span style="font-family:arial,helvetica,sans-serif">But no luck.</span></font><span style="font-family:monospace,monospace"><br></span></font><div><div><div><div><br></div><div>varnishlog looks something like below:-<br><font size="1"><span style="font-family:monospace,monospace">*   << BeReq    >> 3         <br>-   Begin          bereq 2 fetch<br>-   Timestamp      Start: 1451466805.152313 0.000000 0.000000<br>-   BereqMethod    GET<br>-   BereqURL       /rde_server/res/feea8d0b3d50/recomm/home/sid/jb55653bbd980baaf37484ef70bcfcef9b84d7c680ad1b487aed1fb21ac6779025?home_tsFilter=&cat_tsFilter=%28conc.item.brand+not+in+%2836%2C4187%2C4201%2C3721%2C4103%2C4101%2C4199%2C4075%29%29%28conc.item.param1+in+%28+a<br>-   BereqProtocol  HTTP/1.1<br>-   BereqHeader    User-Agent: curl/7.38.0<br>-   BereqHeader    Host: localhost:6081<br>-   BereqHeader    Accept: */*<br>-   BereqHeader    X-Forwarded-For: ::1<br>-   BereqHeader    Accept-Encoding: gzip<br>-   BereqHeader    X-Varnish: 3<br>-   VCL_call       BACKEND_FETCH<br>-   VCL_return     fetch<br>-   FetchError     no backend connection<br>-   Timestamp      Beresp: 1451466805.152502 0.000189 0.000189<br>-   Timestamp      Error: 1451466805.152511 0.000198 0.000009<br>-   BerespProtocol HTTP/1.1<br>-   BerespStatus   503<br>-   BerespReason   Service Unavailable<br>-   BerespReason   Backend fetch failed<br>-   BerespHeader   Date: Wed, 30 Dec 2015 09:13:25 GMT<br>-   BerespHeader   Server: Varnish<br>-   VCL_call       BACKEND_ERROR<br>-   BerespHeader   Content-Type: text/html; charset=utf-8<br>-   BerespHeader   Retry-After: 5<br>-   VCL_return     deliver<br>-   Storage        malloc Transient<br>-   ObjProtocol    HTTP/1.1<br>-   ObjStatus      503<br>-   ObjReason      Backend fetch failed<br>-   ObjHeader      Date: Wed, 30 Dec 2015 09:13:25 GMT<br>-   ObjHeader      Server: Varnish<br>-   ObjHeader      Content-Type: text/html; charset=utf-8<br>-   ObjHeader      Retry-After: 5<br>-   Length         278<br>-   BereqAcct      0 0 0 0 0 0<br>-   End            <br><br>*   << Request  >> 2         <br>-   Begin          req 1 rxreq<br>-   Timestamp      Start: 1451466805.152189 0.000000 0.000000<br>-   Timestamp      Req: 1451466805.152189 0.000000 0.000000<br>-   ReqStart       ::1 44193<br>-   ReqMethod      GET<br>-   ReqURL         /rde_server/res/feea8d0b3d50/recomm/home/sid/jb55653bbd980baaf37484ef70bcfcef9b84d7c680ad1b487aed1fb21ac6779025?home_tsFilter=&cat_tsFilter=%28conc.item.brand+not+in+%2836%2C4187%2C4201%2C3721%2C4103%2C4101%2C4199%2C4075%29%29%28conc.item.param1+in+%28+a<br>-   ReqProtocol    HTTP/1.1<br>-   ReqHeader      User-Agent: curl/7.38.0<br>-   ReqHeader      Host: localhost:6081<br>-   ReqHeader      Accept: */*<br>-   ReqHeader      X-Forwarded-For: ::1<br>-   VCL_call       RECV<br>-   VCL_return     hash<br>-   VCL_call       HASH<br>-   VCL_return     lookup<br>-   VCL_call       MISS<br>-   VCL_return     fetch<br>-   Link           bereq 3 fetch<br>-   Timestamp      Fetch: 1451466805.152650 0.000461 0.000461<br>-   RespProtocol   HTTP/1.1<br>-   RespStatus     503<br>-   RespReason     Backend fetch failed<br>-   RespHeader     Date: Wed, 30 Dec 2015 09:13:25 GMT<br>-   RespHeader     Server: Varnish<br>-   RespHeader     Content-Type: text/html; charset=utf-8<br>-   RespHeader     Retry-After: 5<br>-   RespHeader     X-Varnish: 2<br>-   RespHeader     Age: 0<br>-   RespHeader     Via: 1.1 varnish-v4<br>-   VCL_call       DELIVER<br>-   VCL_return     deliver<br>-   Timestamp      Process: 1451466805.152718 0.000529 0.000068<br>-   RespHeader     Content-Length: 278<br>-   Debug          "RES_MODE 2"<br>-   RespHeader     Connection: keep-alive<br>-   Timestamp      Resp: 1451466805.152773 0.000584 0.000055<br>-   ReqAcct        386 0 386 235 278 513<br>-   End            <br><br>*   << Session  >> 1         <br>-   Begin          sess 0 HTTP/1<br>-   SessOpen       ::1 44193 :6081 ::1 6081 1451466805.152117 14<br>-   Link           req 2 rxreq<br>-   SessClose      REM_CLOSE 0.001<br>-   End            <br><br></span></font></div><div><font size="1"><span style="font-family:monospace,monospace"><font size="2"><font face="arial,helvetica,sans-serif">If I start varnish as below then also everything works fine. I am facing problem only when I start varnish via </font></font><font size="2">sudo service varnish start</font><font size="2"><font face="arial,helvetica,sans-serif"><br></font></font><font size="2">sudo varnishd -n foo -f /etc/varnish/prudsys.vcl -s malloc,1G -T localhost:6082  -a <a href="http://0.0.0.0:6081">0.0.0.0:6081</a></font><font size="2"><font face="arial,helvetica,sans-serif"><br></font></font></span></font></div><div><br></div><div>Can some one let me know what is going wrong? I am using varnish 4.1 on Debian 8.<br></div></div></div></div></div>