1
votes

I have Varnish running on port 80 and Apache running on port 8088 on the same machine (I'm using it for development/testing).

Apache is defined as the backend in VCL as follows:

backend default {
    .host = "127.0.0.1";
    .port = "8088";
    .first_byte_timeout = 600s;
    .probe = {
        .request = "GET /index.php HTTP/1.1"
                "Host: example.com"
                "Connection: close";
        .interval = 5s;
        .timeout = 1s;
        .window = 10;
        .threshold = 8;
    }
}

As you can see I have a probe set up. However, when I do varnishadm backend.list I get

Backend name                   Refs   Admin      Probe
default(127.0.0.1,,8088)       1      probe      Sick 0/10

When I execute wget 127.0.0.1:8088 I get

--2017-04-17 10:20:20--  http://127.0.0.1:8088/
Connecting to 127.0.0.1:8088... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://magento2.dev/?SID=obcv7ifsq5b4ro9jr3hmpb7oi4 [following]
--2017-04-17 10:20:20--  http://magento2.dev/?SID=obcv7ifsq5b4ro9jr3hmpb7oi4
Resolving magento2.dev... 127.0.53.53
Connecting to magento2.dev|127.0.53.53|:80... connected.
HTTP request sent, awaiting response... 503 Backend fetch failed
2017-04-17 10:20:20 ERROR 503: Backend fetch failed.

So could it be the probe is receiving a 503 error? Since the request is going to Varnish instead of Apache. Or am I wrong here?

For the record here is my Virtualhost setup for Apache:

<VirtualHost *:8088>
     ServerAdmin [email protected]
     ServerName magento2.dev
     ServerAlias www.magento2.dev
     DocumentRoot "/var/www/magento2/"
         CustomLog /var/log/httpd/magento2.dev-access.log combined
         ErrorLog /var/log/httpd/magento2.dev-error.log
     <Directory "/var/www/magento2/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
     </Directory>
</VirtualHost>

Any ideas appreciated.

Thanks,

1

1 Answers

7
votes

A probe is successful if the HTTP status being returned is 200 OK. Currently your probe gets redirect 302 Found thus it marks the backend as sick.

You need to make sure that curl -IL http://127.0.0.1:8088/ -H "magento2.dev" does not return any redirect. (Magento settings?)

The following command is more useful in troubleshooting sick backends, since it will show you the HTTP status that is returned:

varnishlog -g raw -i Backend_health