Developer Toolbox
5xx server errorRetry after a delayHeader: Retry-After

503 Service Unavailable

The server is temporarily unable to handle the request, because it is overloaded or down for maintenance. It is expected to recover, and can say when in a Retry-After header.

Open Timestamp Converter Retry-After can be a date: convert it.

Common causes

  • Planned maintenance: the site deliberately serves a maintenance page with a 503.
  • Overload: the worker pool or the connection queue is full, and the server sheds load instead of queueing it.
  • A load balancer has no healthy targets, because every instance failed its health check.
  • Autoscaling hasn't caught up with a spike, or a cold start takes longer than the platform waits.
  • A circuit breaker opened because a dependency (a database, a payment provider) keeps failing.

How to fix it

  • As a client, honor Retry-After and back off with jitter. Thousands of clients retrying at the same moment keep a server down.
  • For maintenance, answer 503 with Retry-After, never 200 or 404: search engines then keep the pages indexed and come back later.
  • Check the load balancer's target health. The health check itself may be what fails: a wrong path, or a check that depends on the database.
  • Look at saturation around the time of the errors: CPU, memory, open connections, queue length.

503 or 429?

503 is the server's problem and applies to everyone. 429 is about one client going over its quota while everyone else is served normally.

503 or 502?

A 503 is a deliberate "not now", often with a time to come back. A 502 means the proxy got no usable answer at all.

Example

HTTP/1.1 503 Service Unavailable
Retry-After: 120
Content-Type: text/html
Cache-Control: no-store

<!doctype html>
<title>Down for maintenance</title>
<p>We'll be back in about two minutes.</p>

Defined in RFC 9110, section 15.6.4.