HTTP, TLS & Web Performance

503 Service Unavailable and Maintenance Done Right

Why servers answer with 503, how to troubleshoot it, and how to run planned maintenance that visitors and search crawlers handle gracefully.

Key takeaways

  • A 503 signals a temporary inability to serve requests, caused by maintenance, overload or an unavailable backend.
  • The Retry-After header can tell browsers, programs and crawlers when to try again.
  • Planned maintenance should return a real 503 status, never a "we'll be back" page with a 200 status.
  • A maintenance page should be self-contained, uncached, and served by something that stays up during the work.
  • A 503 that persists for days stops looking temporary to search engines and users alike.

A 503 Service Unavailable response means the server is reachable but can't handle your request right now, and expects the condition to be temporary. The usual causes are planned maintenance, overload, or a backend that has stopped accepting work.

As a visitor, your best move is to wait and retry. As the person running the site, a 503 is both a symptom to investigate and a tool to use on purpose, because it is the honest way to say "come back shortly."

What 503 tells you

The code is defined in the HTTP semantics standard, RFC 9110, and belongs to the 5xx family of server errors. It differs from other members in what it implies.

A 500 Internal Server Error says something broke while handling the request. A 502 or 504 says an intermediary got a bad reply, or none, from the server behind it. A 503 says the service is declining work for now. In practice, the lines blur: some proxies return 503 when every backend is marked unhealthy.

It also differs from a 429 Too Many Requests, which targets one client that exceeded its allowance. A 503 is about the server's condition.

The usual causes

Where a 503 can come from
503 Service can't take the request now Edge or host limits Provider caps resources or blocks bursts Dependency down Database or API the app needs Stopped service Application pool or process is down Maintenance Deployment or upgrade in progress Overload Workers or queues are full No healthy backend Load balancer has nowhere to send traffic 503 Service can't take the request now Maintenance Deployment or upgrade in progress Overload Workers or queues are full No healthy backend Load balancer has nowhere to send traffic Stopped service Application pool or process is down Dependency down Database or API the app needs Edge or host limits Provider caps resources or blocks bursts

Overload is the classic case. A web server or application runtime has a fixed number of workers. When all are busy and the waiting queue is full, new requests are turned away. A traffic spike can cause this, but so can a single slow database query that ties up every worker.

Health check failures are common behind load balancers. The balancer probes each backend and removes those that fail. If a health check is too strict, or depends on a shaky third-party service, it can remove all of them at once.

Crashed or disabled processes also produce it. On Windows servers running IIS, for example, a stopped application pool typically yields a 503.

Hosting limits matter on shared plans. A provider may refuse requests once your account hits a cap on processes or memory.

Troubleshooting as a visitor

  1. Wait a minute and reload once.
  2. Try the site from another device or network, such as phone data instead of home Wi-Fi.
  3. Check the organization's status page or official social accounts for an announced outage.
  4. If only you see it, restart your browser and try a private window.
  5. If the error mentions a content delivery network or proxy and includes a reference ID, send that ID to the site's support.

If several unrelated sites fail at once, the cause may be a shared provider. Large outages often trace back to one dependency that many services rely on.

Troubleshooting as the owner

Work from the outside in. First find out which layer produced the response. Headers such as Server or a provider-specific request ID often give it away.

curl -sS -D - -o /dev/null https://example.com/

Then check, in order:

  • Is the application running? On Linux with systemd, systemctl status your-service shows its state and recent log lines.
  • What do the logs say? journalctl -u your-service --since "30 minutes ago" and your web server's error log usually name the failure.
  • Are resources exhausted? Look at memory, disk space and processor load with free -h, df -h and top.
  • Are workers saturated? Many runtimes log a warning when they reach their maximum number of processes or threads.
  • Is a dependency slow? A database that has become sluggish can starve the whole application.
  • Did something change? A recent deployment, configuration edit or scheduled job is a strong suspect.

If you can't find the cause quickly, rolling back the last change is often faster than debugging live. Restarting may clear the symptom, but save the logs first so you can learn why it happened. Logs, metrics and traces make this far easier when set up ahead of time.

Planned maintenance that behaves well

The most common mistake in maintenance mode is serving a pleasant "back soon" page with a 200 OK status. Browsers don't care, but caches, monitoring tools and search crawlers do. They may store or index the placeholder as if it were your real content. Redirecting every page to a maintenance URL causes similar confusion.

Return 503 on the original URLs, include Retry-After, and prevent caching:

HTTP/1.1 503 Service Unavailable
Retry-After: 3600
Cache-Control: no-store
Content-Type: text/html; charset=utf-8

The value can be a number of seconds, as above, or an HTTP date. Estimate generously. It's a hint, so nothing breaks if you finish early.

Here is one way to do it in nginx, using the presence of a file as the switch:

server {
    root /var/www/site;

    location / {
        if (-f /var/www/maintenance.on) {
            return 503;
        }
        try_files $uri $uri/ =404;
    }

    error_page 503 @maintenance;

    location @maintenance {
        root /var/www/errors;
        add_header Retry-After 3600 always;
        add_header Cache-Control "no-store" always;
        rewrite ^ /maintenance.html break;
    }
}

Creating the file turns maintenance on and deleting it turns it off, with no reload. The always parameter is needed so nginx adds those headers to error responses. Test the configuration with nginx -t before reloading.

A maintenance window from start to finish
1 Announce Tell users the time window in advance 2 Prepare Back up data and write the rollback plan 3 Switch on 503 Serve the page with Retry-After 4 Do the work Apply changes and test privately 5 Verify Check key pages, sign-in and payments 6 Reopen Remove the switch and watch error rates Announce Tell users the time window in advance 1 Prepare Back up data and write the rollback plan 2 Switch on 503 Serve the page with Retry-After 3 Do the work Apply changes and test privately 4 Verify Check key pages, sign-in and payments 5 Reopen Remove the switch and watch error rates 6

Building a good maintenance page

The page has one job: reassure and inform while your normal system is unavailable.

  • Keep it self-contained. Inline the styles and avoid scripts, fonts or images that live on the server you're taking down.
  • Say what's happening in one sentence and give an expected return time with a time zone.
  • Offer an alternative, such as a status page, support email or phone number.
  • Host it somewhere that survives the work. A proxy, CDN or separate static host is safer than the application itself.
  • Answer APIs in their own language. Programs calling your API should get a 503 with a short JSON body, not a web page.

Give yourself a private way in, such as allowing your office address or a secret header at the proxy, so you can test the real site before reopening. Remove that bypass afterward.

Search engines and duration

Crawlers generally treat a 503 as temporary and return later. Google's published guidance has long recommended it for short downtime. If your robots.txt file returns a server error, crawlers may pause crawling the whole site, so decide deliberately whether that file stays available.

Short windows of a few hours are rarely a problem. If a site serves 503 for days on end, crawlers may begin dropping pages. For a long closure, consider keeping informational pages live and disabling only the functions that can't run. Search engine documentation is the place to confirm current behavior.

Reducing the need for downtime

Many sites can avoid a visible window altogether.

Ways to release changes
Full maintenance Site shows 503 while you work Simplest to reason about Users are blocked Rolling update Update servers a few at a time Needs a load balancer Old and new versions run together Blue-green Build a second full environment Switch traffic when ready Fast rollback, higher cost Full maintenance Site shows 503 while you work Simplest to reason about Users are blocked Rolling update Update servers a few at a time Needs a load balancer Old and new versions run together Blue-green Build a second full environment Switch traffic when ready Fast rollback, higher cost

With rolling or blue-green releases, database changes need care, since two versions of your code may touch the same data. A common approach is to add new columns first, deploy code that works with both shapes, and remove old structures later.

You can also design for partial failure. Serve cached pages while the application restarts, disable checkout while leaving the catalog readable, or queue incoming work for later. Uptime targets help you decide how much of that effort is worthwhile.

Finally, have uptime monitoring in place that distinguishes planned work from surprises. Silence alerts for the window, but set an alarm for the moment it should end, so a forgotten maintenance switch doesn't keep your site closed overnight.

Handling overload gracefully

When demand outruns capacity, turning some requests away quickly is better than letting every request crawl until it fails. This is called load shedding. A server that rejects excess work with a fast 503 keeps its resources for the requests it can finish.

Decide ahead of time what matters most. Sign-in and checkout might deserve priority over search suggestions or report generation. Put limits on queue length so that requests don't wait longer than any visitor would. Set timeouts on calls to databases and outside services, and when one keeps failing, stop calling it for a while and show a reduced version of the page.

Retries need care here. If thousands of clients receive a 503 and all try again immediately, the recovering server gets hit with more traffic than the original surge. A Retry-After value, plus random delay in any client you control, spreads that load out.

Common questions

Is a 503 my fault as a visitor?

Almost never. It describes the server's state. A VPN or proxy on your side can occasionally trigger a provider's protections, so disabling it is a reasonable test.

How long should I set Retry-After?

Use your honest estimate of the remaining time. For overload rather than planned work, a short value is reasonable, and your clients should add random delay so they don't all return together.

Should I use 503 to block bad traffic?

It's better to use codes that describe the situation: 429 for clients that exceed limits and 403 for requests you refuse. Accurate codes keep monitoring and troubleshooting clear.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in HTTP, TLS & Web Performance →

Latest news on this topic