<div dir="ltr">Hi folks. I'm in the process of migrating to from v3 to v5, and have finally got the config compiling at least. Now I'm having some problems with the backends that I can't seem to work out. Apologies, this is a bit of a wordy one...<div><br></div><div>Let's say I have two backends, web01 and web02, and these are put into a director called admin_director for load-balancing. This is all in "backends.vcl":</div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>import directors;</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>probe healthcheck {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">            </span>.request =</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                     </span>"GET / HTTP/1.1"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                     </span>"Host: <a href="http://www.mydomain.co.uk">www.mydomain.co.uk</a>"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                     </span>"Connection: close";</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">         </span>.timeout = 30s;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>.interval = 15s;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">               </span>.window = 10;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">          </span>.threshold = 8;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>.expected_response = 302;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>}</div><div><br></div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>backend web01 { .host = "192.168.1.11"; .port = "80"; .first_byte_timeout = 600s; .probe = healthcheck; }</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>backend web02 { .host = "192.168.1.12"; .port = "80"; .first_byte_timeout = 600s; .probe = healthcheck; }</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>sub vcl_init {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">         </span>new admin_director = directors.shard();</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>admin_director.add_backend(web01);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">             </span>admin_director.add_backend(web02);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>}</div><div><br></div><div><br></div><div>I've now removed all my main VCL for clarification, so my vcl_recv.vcl file contains just:</div><div><br></div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>import std;</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>sub vcl_recv {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">         </span>set req.backend_hint = admin_director.backend();</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">               </span>std.log("Backend hint: " + req.backend_hint);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>}</div></div><div><br></div><div><br><br></div></div><div>I then have my main "default.vcl":</div><div><br></div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>vcl 4.0;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>include "backends.vcl";</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>include "vcl_recv.vcl";</div></div><div><br></div><div><br></div><div>Now to the problem. If I try to access a URL, I always get a "FetchError: No backend"</div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>*   << BeReq    >> 3</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   Begin          bereq 2 fetch</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   Timestamp      Start: 1490802880.486355 0.000000 0.000000</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   BereqMethod    GET</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   BereqURL       /Common/Images/NewLoginImages/training.png</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   BereqProtocol  HTTP/1.1</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   BereqHeader    Host: <a href="http://www.mydomain.com">www.mydomain.com</a></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   BereqHeader    User-Agent: curl/7.35.0</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   BereqHeader    Accept: */*</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   BereqHeader    X-Forwarded-Proto: https</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   BereqHeader    X-Real-Ip: 1.2.3.4</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   BereqHeader    Accept-Encoding: gzip</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   BereqHeader    X-Forwarded-For: 1.2.3.4, 192.168.1.23</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   BereqHeader    X-Varnish: 3</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   VCL_call       BACKEND_FETCH</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   VCL_return     fetch</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   FetchError     No backend</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   Timestamp      Beresp: 1490802880.486447 0.000092 0.000092</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   Timestamp      Error: 1490802880.486452 0.000098 0.000006</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   BerespProtocol HTTP/1.1</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   BerespStatus   503</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   BerespReason   Service Unavailable</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   BerespReason   Backend fetch failed</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   BerespHeader   Date: Wed, 29 Mar 2017 15:54:40 GMT</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   BerespHeader   Server: Varnish</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   VCL_call       BACKEND_ERROR</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   BerespHeader   Content-Type: text/html; charset=utf-8</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   BerespHeader   Retry-After: 5</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   VCL_return     deliver</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   Storage        malloc Transient</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   ObjProtocol    HTTP/1.1</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   ObjStatus      503</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   ObjReason      Backend fetch failed</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   ObjHeader      Date: Wed, 29 Mar 2017 15:54:40 GMT</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   ObjHeader      Server: Varnish</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   ObjHeader      Content-Type: text/html; charset=utf-8</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   ObjHeader      Retry-After: 5</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   Length         278</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   BereqAcct      0 0 0 0 0 0</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   End</div></div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>*   << Request  >> 32770</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   Begin          req 32769 rxreq</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   Timestamp      Start: 1490803780.494500 0.000000 0.000000</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   Timestamp      Req: 1490803780.494500 0.000000 0.000000</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>-   ReqStart       192.168.1.23 36896</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   ReqMethod      GET</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   ReqURL         /Common/Images/NewLoginImages/training.png</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   ReqProtocol    HTTP/1.1</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   ReqHeader      Host: <a href="http://www.mydomain.com">www.mydomain.com</a></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   ReqHeader      User-Agent: curl/7.35.0</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   ReqHeader      Accept: */*</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   ReqHeader      X-Forwarded-For: 1.2.3.4</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>-   ReqHeader      X-Forwarded-Proto: https</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>-   ReqHeader      X-Real-Ip: 1.2.3.4</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   ReqHeader      Accept-Encoding: gzip</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   ReqUnset       X-Forwarded-For: 1.2.3.4</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>-   ReqHeader      X-Forwarded-For: 1.2.3.4, 192.168.1.23</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   VCL_call       RECV</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   Error          shard admin_director: no backends</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   VCL_Log        Backend hint:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   VCL_return     hash</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   VCL_call       HASH</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   VCL_return     lookup</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   VCL_call       MISS</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   VCL_return     fetch</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   Link           bereq 32771 fetch</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   Timestamp      Fetch: 1490803780.495705 0.001204 0.001204</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   RespProtocol   HTTP/1.1</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   RespStatus     503</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   RespReason     Backend fetch failed</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>-   RespHeader     Date: Wed, 29 Mar 2017 16:09:40 GMT</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   RespHeader     Server: Varnish</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   RespHeader     Content-Type: text/html; charset=utf-8</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   RespHeader     Retry-After: 5</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   RespHeader     X-Varnish: 32770</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   RespHeader     Age: 0</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   RespHeader     Via: 1.1 varnish (Varnish/5.1)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   VCL_call       DELIVER</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-   VCL_return     deliver</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   Timestamp      Process: 1490803780.495723 0.001223 0.000019</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>-   RespHeader     Content-Length: 282</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>-   Debug          "RES_MODE 2"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>-   RespHeader     Connection: keep-alive</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>-   Timestamp      Resp: 1490803780.495806 0.001305 0.000082</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>-   ReqAcct        238 0 238 250 282 532</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>-   End</div></div><div><br></div><div>But my backend.list seems to always be healthy:</div><div><br></div><div><div>    boot.web01                     probe      Healthy             10/10 Wed, 29 Mar 2017 15:54:18 GMT</div><div>    boot.web02                     probe      Healthy             10/10 Wed, 29 Mar 2017 15:54:18 GMT</div></div><div><br></div><div>From the varnish server, I can reach the backends successfully manually:</div><div><br></div><div>    curl --resolve www.mydomain.com:192.168.1.11 <a href="http://www.mydomain.com/Common/Images/NewLoginImages/training.png">http://www.mydomain.com/Common/Images/NewLoginImages/training.png</a></div><div><br></div><div>Not sure what it all means.</div></div>