Magento – Apache reverse-proxy to serve SSL to Varnish on magento 2 – results in 503 Backend Fetch Failed

apachemagento2.2.3varnish

magento 2 install on a centos 7 server. with a LAMP stack (php 7)

we have installed magento 2.2.3 with the virtual hosts only using SSL through port 443 and have now come to installing and configuring varnish

varnish 5 installed, varnish configuration exported from the backend of magento and listening on port 80, apache listening internally on port 8080.

now if i try and set apache up to act as the SSL termination by listening on port 443 and forward this to varnish on 80 by adding

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:80/
ProxyPassReverse / http://127.0.0.1:80/

to our ssl.conf we get a 503 Backend Fetch Failed error

after searching around, i found the magento devdocs troubleshooting, and have already increased the

http_resp_hdr_len

and the

http_resp_size

but i still get the 503 error.

I have seen people suggesting that the /pub/health_check.php is located/listed wrong in the varnish.vcl that magento generates but this seems to have been patched in 2.2.2

i have also seen people suggest downgrading php to 5.6 but that seems pretty extreme.

does anyone have a solution for this?

EDIT:

this has been resolved, it was a combination of the /pub/health_check.php issue seen elsewhere, missing virtualhosts as a result of the server being locked to only port 443 for security (we made a new vhost for port 80 for varnish, and for port 8080 for apache's backend listen port) AND the DocumentRoot line not being required in the virtualhosts file for the SSL connections (but IS required in the vhosts for port 80 and 8080)

hope this helps anyone else with our issue to resolve it, the site is flying now.

Best Answer

this has been resolved, it was a combination of the /pub/health_check.php issue seen elsewhere, missing virtualhosts as a result of the server being locked to only port 443 for security (we made a new vhost for port 80 for varnish, and for port 8080 for apache's backend listen port) AND the DocumentRoot line not being required in the virtualhosts file for the SSL connections (but IS required in the vhosts for port 80 and 8080)

hope this helps anyone else with our issue to resolve it, the site is flying now.

Related Topic