Uptime monitoring from outside your own infrastructure that alerts you the minute your site goes down — upordown.online

A 503 Service Unavailable is a deliberate "I can't handle this right now" from some hop in the path. That is different from a 502 (the proxy tried a backend and got garbage) and from a 504 (the proxy waited too long). The 503 is often the most fixable of the three, once you know who issued it. It is also the one most often left on after a maintenance window.

Here is how to find the source and what to do for each common cause.

Who returned the 503?

curl -sS -D- -o /tmp/body --max-time 20 https://example.com/path-that-fails 

The body and headers are more useful than the status alone:

  • nginx default 503 is a short plain-text or HTML page and usually Server: nginx. In the error log you will often see no live upstreams or upstream prematurely closed connection.
  • AWS ALB returns a 503 when there are no healthy targets, with Server: awselb/2.0.
  • Cloudflare 503 can be an origin 503 passed through, or Cloudflare itself (overload, or a challenge that went wrong). A cf-ray plus an error code in the body helps.
  • Your app may render a branded "we'll be back" page with a 503, or a framework default.
  • A WAF or API gateway may 503 (or 429) on a rule. Look for a request id header.

If you have access logs at more than one hop, compare. A 200 in the app log and a 503 at the load balancer means the balancer didn't like the target health, not that the app failed the request you are looking at.

Cause 1: no healthy backends

This is the classic 503. The proxy wants to forward the request and has nobody to send it to.

Check the pool, not just one host:

# systemd / a single app systemctl is-active myapp # Kubernetes kubectl get pods -l app=myapp kubectl get endpointslices -l app=myapp 

A pod can be Running and still not in the Service endpoints if the readiness probe is failing. That is the most common Kubernetes 503 I see: a probe that started failing after a deploy (wrong path, slower boot, a dependency the probe now needs), the Service empties out, the ingress returns 503, and the app logs look quiet because they are not receiving traffic.

On an ALB or nginx upstream, look at target health and at the health check URL. A health check that points at a missing path, or that requires a cookie, will mark every instance unhealthy and 503 the site, while curl to a node from a bastion still works.

Fix: restore at least one healthy target first (roll back, fix the probe, start the process). Then fix why they all left the pool at once. Do not lower the health check until it is meaningless just to get a green box; you will hide the next outage.

Cause 2: a drain or a deploy

During a rolling deploy or a server shutdown, instances are supposed to leave the pool, finish in-flight work, then die. If the new instances are slow to become ready, or if the deploy takes all replicas down before any are up, the pool is empty for a while and everyone gets 503.

Look at the deploy timeline against the 503s. If they line up:

  • Give new instances more time to pass readiness before old ones are removed (minReadySeconds, a longer pre-stop, a surge of extra replicas).
  • Make sure the pre-stop hook stops accepting new work and still lets the health check fail, so the proxy stops sending traffic before the process exits.
  • Don't run a migration that locks the database in the same window, or every new replica will fail readiness together.

Cause 3: a maintenance page left on

Many teams flip a flag, an nginx return 503, a CDN worker, or a feature toggle to serve "we'll be back at 06:00". The work finishes, the homepage is restored, and a more specific path — /login, /api, a regional name — stays on the 503. Or the flag is in Redis and survives the deploy that was supposed to clear it.

Search for the maintenance string in the response body and in your config:

grep -R "we'll be back\|maintenance_mode\|return 503" nginx/ app/ config/ 

Confirm with curl on each important hostname, not just /. Then put a calendar reminder, or better, a monitor on the public path, so a leftover 503 is an alert and not a Monday-morning Slack thread.

A 503 on purpose and a 503 by accident look the same to a visitor, and both should be visible from outside. upordown.online checks the public URL from outside your infrastructure, so a maintenance flag you forgot to clear, or a pool with no healthy targets, becomes an alert instead of a quiet empty site.

Cause 4: overload and rate limits

Some proxies return 503 when a queue is full or a rate limit is hit (others use 429). If the 503s spike with traffic, look at worker counts, database connections, and gateway quotas. Adding retries from the client without a backoff will make this worse. Shed load on a cheap path, or queue the expensive work, rather than raising limits blindly.

A short order to work in

  1. Read the 503 body and headers; decide which hop issued it.
  2. Check whether any backends are healthy in that hop's pool.
  3. If the pool is empty, find out why (readiness, crash, drain, health check URL).
  4. If the pool is healthy, look for a maintenance flag, a path-specific 503, or a rate limit.
  5. Confirm recovery from outside, on the same URL a customer uses.

A 503 is often the system doing something explainable. The failure is usually that nobody is looking at the explanation.

Related reading

What's the most embarrassing 503 you've shipped — a leftover maintenance page, a readiness probe, or something else?