503 Service Unavailable

The server is up but not taking this request at the moment, because it is overloaded or down for maintenance. The condition is expected to pass.

What 503 means

A 503 is the one 5xx code that describes a temporary state rather than a fault. The server is telling you that the same request is likely to work later. It may add a Retry-After header to say when; the header is optional, and plenty of 503s arrive without it.

The specification also notes that a server under load is not obliged to send 503 at all. Some just refuse connections, which a client sees as a network error rather than a status code.

Where 503s come from

  • Deliberate maintenance. The site is switched to a holding page during a deploy or migration.
  • Load shedding. The application or proxy has a limit on concurrent work (worker pool, queue length, connection count) and rejects what does not fit.
  • nginx rate limiting. limit_req and limit_conn reject with 503 unless you change limit_req_status and limit_conn_status. For per-client limits 429 is the clearer answer.
  • No healthy backend. A load balancer whose health checks have all failed answers 503 itself. Apache's mod_proxy does the same when it cannot connect to the backend, and keeps the worker out of use for the retry period (60 seconds by default).
  • A platform limit. Hosts answer 503 for an app that is stopped, still starting up, or over its plan's quota.

Retry-After

The value is either a number of seconds or an HTTP date:

Retry-After: 120
Retry-After: Sat, 14 Nov 2026 07:30:00 GMT

As a client, wait at least that long. Without the header, back off exponentially (1 s, 2 s, 4 s and so on) with some random jitter and give up after a few attempts. Retrying instantly in a tight loop is how a brief overload becomes a long one.

A maintenance page that sends the right status

A "back soon" page served with status 200 gets cached and indexed as if it were your content. Serve it as a 503:

location / {
    return 503;
}
error_page 503 /maintenance.html;
location = /maintenance.html {
    root /var/www/errors;
    internal;
    add_header Retry-After 3600 always;
}

The always parameter matters: without it nginx adds headers only to successful and redirect responses. In Apache the equivalent is a RewriteRule with the [R=503] flag plus ErrorDocument 503 /maintenance.html and Header always set Retry-After "3600".

Google treats 5xx responses as a signal to slow its crawling and keeps indexed pages for a while, so a 503 during a short maintenance window is safe. URLs that keep failing are eventually removed, so do not leave it up for days.

Fixing unplanned 503s

  • Work out which layer sent it. The Server header and the look of the error page separate a CDN, a load balancer, the web server and the application.
  • At the load balancer, look at backend health checks. A check that hits a slow endpoint fails under load and takes healthy servers out of rotation, which makes the overload worse.
  • In nginx, limiting requests, excess: in the error log means a limit_req rule fired.
  • In the application, compare concurrent requests with the worker or thread pool size, and look for a slow dependency that is tying workers up.
  • If nothing in your stack is failing but visitors report 503s, test the site from outside to see what they see.

503 compared with 500, 502, 504 and 429

CodeSaysRetry?
503 Service UnavailableNot now: overloaded or in maintenanceYes, after Retry-After or a back-off
500 Internal Server ErrorSomething broke while handling this requestMaybe; it may fail the same way again
502 Bad GatewayThe proxy got a bad answer from the backendYes, shortly
504 Gateway TimeoutThe backend was too slow for the proxyCarefully; the first attempt may still be running
429 Too Many RequestsYou, specifically, are sending too muchYes, more slowly

Example 503 response

HTTP/1.1 503 Service Unavailable
Retry-After: 120
Content-Type: text/plain; charset=utf-8
Content-Length: 48
Cache-Control: no-store

Down for maintenance. Back in about two minutes.

Retry-After: 120 asks clients to wait two minutes. Cache-Control: no-store keeps an intermediate cache from replaying the outage after it has ended.

Defined in RFC 9110, section 15.6.4.

Questions

How long does a 503 error last?

As long as the overload or maintenance behind it. If the response has a Retry-After header, that is the server's own estimate. Without one there is no way to tell from the outside; retry after a minute or two.

Is 503 the right status code for a maintenance page?

Yes. It tells browsers, API clients and search engines that the outage is temporary and the real content will return. Add a Retry-After header, and never serve the maintenance page with status 200.

What is the difference between 500 and 503?

A 500 says the server failed unexpectedly while handling the request. A 503 says the server is knowingly not handling requests for the moment. The practical difference is that a 503 invites a retry later, and a 500 gives no such hint.

Will a 503 hurt my search rankings?

A short one will not. Google reduces its crawl rate while it sees server errors and picks up again once normal responses return. Pages that return 5xx persistently are eventually dropped from the index.