Varnish Error 503: Backend Fetch Failure and Log Messages Indicating No Backend

I am relatively new to using Varnish and am encountering an error when attempting to access my website. The error message I receive is as follows:

<body>
    <h1>Error 503 Backend fetch failed</h1>
    <p>Backend fetch failed</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 3</p>
    <hr>
    <p>Varnish cache server</p>
</body>

Description of Issue: Despite adjusting the .timeout value, it seems to have no impact as the error returns immediately. The following command works as intended:

curl --header "Host: serverx.dev" 192.168.56.10:8080/index.php

However, this command fails, resulting in a “Backend fetch failed” message:

curl --header "Host: serverx.dev" 192.168.56.10:80/index.php

Environment Details:

  • Varnish version: 4.1.5
  • Host OS: Windows 7 (64-bit)
  • Guest OS: Debian Jessie (minimal install)
  • Apache2 running on port 8080 and Varnish on port 80.

Varnish Configuration (default.vcl):

vcl 4.0;
import std;
import directors;
backend backendOne {
    .host = "192.168.56.10";
    .port = "8080";
    .probe = {
        .url = "/robots.txt";
        .interval = 5s;
        .timeout = 50s;
        .window = 5;
        .threshold = 3;
    }
}
sub vcl_init {
    new backendGroup = directors.round_robin();
    backendGroup.add_backend(backendOne);
}

Current Varnish Status:

ps -ef | grep varnish
varnish   4210     1  0 11:26 ?        00:00:00 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

Additional Logs from Varnish:

-   BereqHeader    X-Varnish: 51
-   VCL_call       BACKEND_FETCH
-   VCL_return     fetch
-   FetchError     Director cluster returned no backend
-   FetchError     No backend
-   BerespStatus   503
-   BerespReason   Service Unavailable

If anyone has insights or suggestions that could help resolve this problem, I would greatly appreciate it!

could be an issue with how apache is set up on port 8080. try checking if there are any firewall rules or network configs that might be blocking this connection. also, make sure there’s no misktake in your vcl file, seems everything should route to port 8080.

A possible cause of the 503 error might involve your backend server configuration, particularly the health check settings. When the probe parameters, like the URL or timeout, are misaligned, Varnish may mark the backend as unhealthy. Ensure that the file specified in the probe URL exists and is accessible. Additionally, verify network stability between Varnish and the backend server, as packet loss or latency could result in probe failures, leading Varnish to erroneously consider the backend as unavailable.