breakitdown

503 Service Unavailable

Answer

503 Service Unavailable means the server, or a proxy in front of it, is temporarily unable to handle the request: it is overloaded, in maintenance, or has no healthy backend to send it to. It is meant to be temporary.

503
Service Unavailable RFC 9110 §15.6.4

The server is temporarily unable to handle the request, from overload or maintenance.

It signals a temporary condition, and the server may send Retry-After to say when to come back. Load balancers return it when no healthy backend is available, and nginx returns it by default when limit_req or limit_conn rejects a request. Search engines treat a short-lived 503 as downtime rather than a removed page.

Explained

Unlike 502 and 504, a 503 is often a deliberate decision. A load balancer sends it when every backend fails its health checks or none is registered. An app sends it in maintenance mode or when it sheds load. nginx sends it by default when limit_req or limit_conn rejects a request.

The server can include Retry-After to say when to try again. Search engines treat a brief 503 as temporary downtime and keep the page indexed, which makes it the right status for planned maintenance; a maintenance page served with 200 can replace your content in search results.

In Kubernetes, an ingress controller returns 503 when the Service has no ready endpoints: the pods are failing readiness probes, the selector does not match the pod labels, or the deployment is scaled to zero.

How to debug it

  1. Identify who sent the 503: the response body, a Server header or the proxy's log usually make it obvious.
  2. If it is a load balancer, check target health and the health check path, port and expected status code.
  3. In Kubernetes, run kubectl get endpoints <service>; an empty list means no pod is ready or the selector is wrong.
  4. If it is nginx, look for limiting requests in the error log, which points to limit_req.
  5. Check resource saturation on the backends: CPU, memory, connection pools, thread or worker counts.

Gotchas

Related explainers

← All HTTP status codes