Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 503 Backend fetch failed

I have this error in my site

Error 503 Backend fetch failed

Backend fetch failed

Guru Meditation:

XID: 526707

Varnish cache server

Anyone know what may be the cause or how to find out what happens?

like image 564
WebDeveloper Avatar asked May 06 '15 06:05

WebDeveloper


3 Answers

There's a common reason that varnish returns 503 that is not explained on the varnish error list. I have learnt this from experience.

If your web server is returning 500 error or similar then varnish simply says Error 503 Backend fetch failed.

what you need to do is to always try to fetch without varnish to see if the error is in varnish or the web server. For example if you have a different hostname for the webserver, load that and find the error, if you fix that, then restart varnish and that solves it most of the time.

like image 153
moebin Avatar answered Oct 07 '22 22:10

moebin


That means that Varnish has been properly configured to accept incoming connections, but is not yet available to serve your backend. This error is common when varnish receives a request but your backend is still restarting/releasing.

like image 26
crico_aven Avatar answered Oct 08 '22 00:10

crico_aven


This can be due to the length of cache tags used by Magento exceeding Varnish’s default of 8192 bytes.

This can be solved by modifying the varnish configs:

  • CentOS 6: /etc/sysconfig/varnish
  • CentOS 7: /etc/varnish/varnish.params
  • Ubuntu: /etc/default/varnish

Find http_resp_hdr_len. If the parameter doesn’t exist, add it after thread_pool_max.

Magento suggests setting http_resp_hdr_len to a value equal to the product count of your largest category multiplied by 21.

For example, setting the value to 65536 bytes should work if your largest category has 3,000 products:

-p http_resp_hdr_len=65536 \

See here: http://devdocs.magento.com/guides/v2.0/config-guide/varnish/tshoot-varnish-503.html

like image 1
harri Avatar answered Oct 07 '22 23:10

harri