Skip to content

Troubleshooting guide

Error 503 Backend fetch failed (Varnish): how to fix it

Varnish (also behind Fastly and many hosts) could not get a response from the backend server. The "Guru Meditation" page includes an XID you can find in the logs.

3 min read10 sectionsUpdated

On this page

Key points

  • Varnish is fine; the backend is not.
  • Timeouts and unhealthy probes are the main causes.
  • Huge headers can make Varnish give up.
  • Use the XID to find the request in varnishlog.

What it means

Varnish fetches from a backend (your application server) when it has no cached copy. If the backend is down, marked unhealthy by health probes, too slow for first_byte_timeout, or returns something Varnish cannot handle, it answers "Error 503 Backend fetch failed" with a Guru Meditation XID.

Common causes

  • The application server down or overloaded.
  • Responses slower than first_byte_timeout or between_bytes_timeout.
  • Health probes failing (wrong URL, auth required).
  • Response headers larger than http_resp_hdr_len.
  • Backend closing connections early.

Fixes if you are visiting the site

  1. Reload after a minute; it is a server-side problem.

Fixes if it is your site

Look up the XID in varnishlog to see the backend error, check backend health with varnishadm backend.list, and test the backend directly. Raise timeouts only after fixing slow endpoints.

bash
varnishadm backend.list
varnishlog -q "VXID == 12345" -g request
curl -sI http://127.0.0.1:8080/ -H "Host: example.com"   # the backend directly

Who produced the error: the CDN or your origin?

CDN error pages are generated at the edge, but most of them describe a problem behind it. Request the origin directly (with the right Host header) to see whether it answers on its own; compare response headers with and without the CDN; and check the CDN’s status page to rule out a provider incident. Keep an uptime check on the public URL (through the CDN) and, if you can, another on the origin, so an alert tells you straight away which side failed. During an incident, post a short update on a status page that does not depend on the same CDN.

How site owners catch this before visitors do

Most visitors who hit Error 503 Backend fetch failed (Varnish) leave without telling you. An uptime check every minute, with a keyword assertion on the page and an SSL check on every run, turns this from a support ticket into an alert. Keep the history: errors that come and go (one region, one server behind a load balancer, one in twenty requests) only make sense on a timeline. Put the result on a status page so people stop guessing. You can test any address now with the free website down checker.

Frequently asked questions

What is Guru Meditation?

Varnish’s name for its error page; the XID identifies the request.

Is my cache broken?

No, the backend behind it failed.

Does Fastly show this too?

Fastly is built on Varnish and shows similar errors when origins fail.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.