Showing results for 
Search instead for 
Did you mean: 

503 Backend Fetch Failed - Error comes up multiple times a day

503 Backend Fetch Failed - Error comes up multiple times a day

My website keeps crashing and giving an "error 503 backend fetch failed" error when you try to go to it. To temporarily fix it I reset my server the website is hosted on, and it seems to fix the problem momentarily. But normally within 8-12 hours the website will crash again and give the same backend fetch failed error. The exact error reads:


Error 503 Backend fetch failed

Backend fetch failed

Guru Meditation:

xid: XXXXXXX<-----(random number every time the error comes up)

Varnish cache server


I changed the config based on suggestions I found in Magento DevDoc but nothing seems to work:


Screenshot of error:WebsiteCrashError.PNG


Does anyone have any ideas what the problem may be?



Re: 503 Backend Fetch Failed - Error comes up multiple times a day

Hello @matt_nelsen 


Try to fetch the website without varnish to see if the error is in varnish or the webserver, in your case, it seems from the hosting side.


For example, if you have a different hostname for the webserver, load that and find the error, if you can fix that,

Restart varnish and it should resolve your issue.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: 503 Backend Fetch Failed - Error comes up multiple times a day

Anybody else have a similar problem?

Re: 503 Backend Fetch Failed - Error comes up multiple times a day

I have the same problem as you mention. you may want to take a look at this post


Re: 503 Backend Fetch Failed - Error comes up multiple times a day


First of all, you have to identify why this error is occurring again and again. It can be due to various reasons:

1. lack of memory.
2. The varnish is not working from the backend.
3. The extensive number of requests on the server.
4. SSL couldn't configure successfully

How to fix this issue?
look for the scalability if you can or ask the hosting provider to do it for you. Second, remove the maintenance.flag file and hit the URL again.

If it works with you, do let me know! 

Re: 503 Backend Fetch Failed - Error comes up multiple times a day

Hello matt_nelsen,


The most common error that Magento 2 user encounter is 503 Backend fetch failed with varnish cache. Here are some possible causes for the error to occur,


Length of cache tags utilized by Magento exceeds Varnish's default value:


If your store has many products (more than 400), the error might occur because the length of cache tags utilized by Magento 2 exceeds the default value of Varnish. The default value of Varnish is 8192 bytes.


We'll have to change the http_resp_hdr_len value in the Varnish configuration file to fix the issue.


The path to the varnish configuration file,


Ubuntu: /etc/default/varnish

Centos 6: /etc/sysconfig/varnish

Centos 7: /etc/varnish/varnish.params


Then, edit the file with a text editor and change the http_resp_hdr_len value.



-p http_resp_hdr_len=8192 \

To larger value:

-p http_resp_hdr_len=70000 \

Now, change http_resp_size to the value that fit the increased value of http_resp_hdr_len,



-p http_resp_size=32768 \


-p http_resp_size=100000 \


Lastly, save the file and restart Magento 2 server to apply changes.


Wrong health_check.php location in the Varnish config file:


The other cause for the error to appear is the wrong health_check.php file location in a varnish configuration file.


By default, the path to the health_check.php file in varnish is /pub/health_check.php


In Magento 2, nginx.conf.sample already set root path to /pub > that is the wrong path in a varnish configuration file. 


Firstly, navigate to the Varnish configuration file (/etc/varnish/default.vcl) and locate the below lines:


.probe = {
        .url = "/pub/health_check.php";


Next, change it to:


 .probe = {
        .url = "/health_check.php";


Then, navigate to the nginx.conf.sample file in Magento 2 root folder, locate the following lines:

location ~ (index|get|static|report|404|503)\.php$ {


Now, add health_check to the above line to allow the health_check.php file as below,

location ~ (index|get|static|report|404|503|health_check)\.php$ {


Lastly, save changes and restart varnish and nginx to apply changes.


Maintenance.flag file developed by Magento 2:


The error can also be caused by the var/.maintenance.flag file generated by Magento 2 when you install new extensions/themes or maintain, upgrade, or reconfigure your site.


In order to fix the issue, you can open a file manager and rename/remove maintenance.flag file and refresh your website to see if the error is resolved.


Thus, I hope the methods mentioned above help you to fix the Error 503 Backend fetch failed with a varnish cache. 




Rex M


AccuWeb Hosting | Magento Hosting

Re: 503 Backend Fetch Failed - Error comes up multiple times a day

There could be a few reasons why your Magento site keeps crashing with a 503 Backend Fetch Failed error:

Resource Limitations: The most common cause is the backend server running out of memory or maxing out the CPU, so it fails to respond to requests from Varnish. Check usage when the site crashes and optimize/scale up resources if needed.

Caching Issues: Problems with caching configuration can cause the backend to be hit repeatedly and get overloaded. Ensure Magento and Varnish caches are configured properly and cache flush/invalidation is working.


Some specific things to try:

  • Increase backend resources (memory/CPU)
  • Tune MySQL configuration & indexes
  • Enable Varnish debugging to see what requests fail
  • Review logs for errors around the time of crashes

Hope this gives you a framework to debug the intermittent crashes.