503

Service Unavailable

5xx · Server Error common

Overview

503 Service Unavailable means the server is temporarily unable to handle the request due to overload or maintenance. The server is alive but cannot take requests right now — an intentional or temporary condition.

A well-formed 503 uses a Retry-After header to say when to try again. During planned deploys or maintenance it also serves as a proper "we're down for maintenance" page for users.

When it happens

Request / Response example

Request
GET / HTTP/1.1
Host: www.example.com
Response
HTTP/1.1 503 Service Unavailable
Retry-After: 120
Content-Type: text/html

<h1>503 Service Unavailable</h1>
<p>We are down for maintenance. Please try again shortly.</p>

In code

app.use((req, res, next) => {
  if (process.env.MAINTENANCE === '1') {
    return res.status(503).set('Retry-After', '120').send('Under maintenance');
  }
  next();
});
location / {
  if (-f /etc/nginx/maintenance.on) {
    return 503;
  }
  proxy_pass http://backend;
}
error_page 503 /maintenance.html;

Common causes

How to fix

Notes

Related status codes

Related headers

Specification