Causes
- Server overloaded — too many concurrent requests, server resources exhausted
- Planned maintenance — server intentionally taken offline for updates
- Application crash — web server running but application process is down
- Rate limiting — some servers return 503 when rate limits are hit (others use 429)
- Database unavailable — server is up but dependency is down
Retry-After Header
A well-behaved 503 response includes a Retry-After header telling clients when to try again:
HTTP/1.1 503 Service Unavailable
Retry-After: 3600
Content-Type: text/html
<!-- or -->
Retry-After: Wed, 21 Oct 2026 07:28:00 GMT
Search engine crawlers (Googlebot) respect this header — they'll come back after the specified time and not treat it as a permanent failure.
Implementing Maintenance Mode
# Apache .htaccess — maintenance mode
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000 # allow your IP
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
<!-- maintenance.html -->
<!DOCTYPE html>
<html>
<head>
<title>Down for Maintenance</title>
<!-- IMPORTANT: return actual 503 status -->
</head>
<body>
<h1>We'll be back soon</h1>
<p>We're performing scheduled maintenance. Back online at 10:00 AM UTC.</p>
</body>
</html>
Prevention & Scaling
- Set up autoscaling if on cloud hosting (AWS, Google Cloud, Vercel)
- Use a CDN to absorb traffic spikes
- Implement request queuing for high-traffic endpoints
- Add health checks so load balancers stop sending traffic to failing instances
- Cache responses aggressively to reduce server load