Skip to content
Webmaster Tools
Inspect & debugHTTP Status Codes503 Service Unavailable

503 Service Unavailable

What HTTP 503 Service Unavailable means, how to serve it with Retry-After for maintenance in nginx and Apache, why unplanned 503s happen, and how Google handles it.

All status codes

What 503 means

The server can't handle the request right now, because it's overloaded or down for maintenance, and expects to recover. 503 is defined in RFC 9110 §15.6.4. Unlike 500, it says the problem is temporary, and the server can say when to come back with Retry-After (seconds or an HTTP date):

HTTP/1.1 503 Service Unavailable
Retry-After: 3600
Content-Type: text/html

<h1>Down for maintenance</h1><p>Back within the hour.</p>

Common causes

  • Planned maintenance with a maintenance page switched on (WordPress writes a .maintenance file during updates and answers 503 until it's done).
  • Overload protection: the server or app refuses new work when its queue or connection pool is full.
  • No healthy backends: a load balancer, Kubernetes Service or HAProxy backend with every target failing its health check.
  • Hosting limits: shared hosts return 503 when an account exceeds its process or CPU limits.
  • Rate limiting set up with 503 (nginx's limit_req default status is 503; limit_req_status 429 is clearer).

How to serve it for maintenance

Return 503 with Retry-After on every page, and keep the status even though you show a friendly page. In nginx:

error_page 503 /maintenance.html;

location = /maintenance.html {
    internal;
    add_header Retry-After 3600 always;
}

location / {
    if (-f /var/www/maintenance.on) { return 503; }
    try_files $uri $uri/ /index.php?$args;
}

In Apache, add this block for the duration of the work and remove it afterwards (the Header line applies to every response):

ErrorDocument 503 /maintenance.html
Header always set Retry-After "3600"
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/maintenance.on -f
RewriteCond %{REQUEST_URI} !=/maintenance.html
RewriteRule ^ - [R=503,L]

Never redirect everything to a maintenance URL that returns 200: search engines would see one page replacing the whole site.

How to fix an unexpected 503

  1. Find which layer sends it from the Server header and the error page (nginx, a load balancer, a CDN, the app).
  2. For load balancers, check the health of each target and what the health-check URL returns.
  3. Look for resource exhaustion: CPU, memory, worker counts, database connections.
  4. As a client, honour Retry-After and back off; don't retry in a tight loop.

503 and SEO

503 is Google's recommended way to take a site down temporarily. Googlebot slows its crawling when it sees 5xx responses, and already indexed URLs are kept for a while. If the 503 lasts more than a few days, Google treats it as a lasting error and starts dropping URLs from the index. A 503 on robots.txt pauses crawling of the whole site. Google documents its slowdown in general terms, so don't count on Retry-After setting Googlebot's exact return time.

Check that your maintenance page really answers 503 with the Redirect Checker, or inspect the headers with the HTTP Request Builder.