The server is currently unable to handle your request because it is temporarily overloaded or undergoing scheduled maintenance. Unlike 500, which indicates a bug, 503 signals a temporary condition and the server should recover on its own.
HTTP 503 Service Unavailable is a server error status code indicating that the server is temporarily unable to handle the request. This is typically a transient condition caused by server overload, maintenance, or dependency failures. The key word is "temporarily": unlike 500 Internal Server Error, which may indicate a bug requiring a code fix, 503 implies the server will recover on its own without code changes. The server should include a Retry-After header telling clients when to expect the service to be available again.
In production infrastructure, 503 serves an important role as a controlled failure response. Rather than accepting requests that it cannot process properly and returning corrupted data or crashing, the server proactively rejects requests with 503 when it detects overload conditions. This is a deliberate design choice that protects data integrity and allows the server to recover. Load balancers, reverse proxies, and application servers all use 503 to signal temporary unavailability.
From an SEO perspective, 503 is the correct status code to use during scheduled maintenance. Google treats 503 as a temporary condition and will return to crawl the page later. Using 503 instead of 404 or 500 during maintenance ensures that search engine rankings are preserved. Google specifically recommends using 503 with a Retry-After header during extended maintenance periods to prevent Googlebot from dropping pages from the index.
The server is receiving more traffic than it can handle. All worker processes or threads are busy serving other requests, and new requests cannot be accepted until capacity frees up.
The server is intentionally taken offline for updates, database migrations, or infrastructure changes. A 503 with a Retry-After header tells clients when to expect the service to return.
A critical external dependency, such as a database, cache, or third-party API, is down. The server cannot process requests without this dependency and returns 503 until it recovers.
During a rolling deployment, some instances are being updated while others serve traffic. If all instances are briefly unavailable during the transition, the load balancer returns 503.
The 503 response should include a Retry-After header indicating when the service will be available again. Wait at least that long before retrying. This header can be a number of seconds or an HTTP date.
If 503 errors result from traffic overload, scale your infrastructure horizontally by adding more instances, or vertically by increasing CPU and memory on existing servers.
Use circuit breaker patterns for external dependencies. When a dependency is down, fail fast with a cached response or degraded functionality rather than holding requests open until they time out.
During planned maintenance, configure your load balancer or reverse proxy to serve a static maintenance page with a 503 status code and Retry-After header. This provides a better experience than connection refused errors.
// Express.js — maintenance mode and overload protection
const express = require('express');
const app = express();
// Maintenance mode middleware
const isMaintenanceMode = () => process.env.MAINTENANCE_MODE === 'true';
app.use((req, res, next) => {
if (isMaintenanceMode()) {
res.set('Retry-After', '3600'); // Back in 1 hour
return res.status(503).json({
error: 'Service Unavailable',
message: 'Scheduled maintenance in progress',
retryAfter: 3600,
estimatedReturn: new Date(Date.now() + 3600000).toISOString()
});
}
next();
});
// Connection pool overload detection
let activeConnections = 0;
const MAX_CONNECTIONS = 1000;
app.use((req, res, next) => {
if (activeConnections >= MAX_CONNECTIONS) {
res.set('Retry-After', '30');
return res.status(503).json({
error: 'Service Unavailable',
message: 'Server is at capacity. Please retry shortly.',
retryAfter: 30
});
}
activeConnections++;
res.on('finish', () => { activeConnections--; });
next();
});
// Health check with dependency status
app.get('/health', async (req, res) => {
const dbHealthy = await checkDatabase();
const status = dbHealthy ? 200 : 503;
res.status(status).json({
status: dbHealthy ? 'healthy' : 'degraded',
database: dbHealthy ? 'connected' : 'unreachable'
});
});
# Flask — maintenance mode and overload protection
from flask import Flask, jsonify, request
import os
import threading
app = Flask(__name__)
# Maintenance mode check
def is_maintenance():
return os.environ.get('MAINTENANCE_MODE') == 'true'
@app.before_request
def check_maintenance():
if is_maintenance():
response = jsonify(
error='Service Unavailable',
message='Scheduled maintenance in progress',
retry_after=3600
)
response.status_code = 503
response.headers['Retry-After'] = '3600'
return response
# Connection tracking for overload protection
active_connections = 0
lock = threading.Lock()
MAX_CONNECTIONS = 1000
@app.before_request
def check_capacity():
global active_connections
with lock:
if active_connections >= MAX_CONNECTIONS:
response = jsonify(
error='Service Unavailable',
message='Server at capacity. Retry shortly.',
retry_after=30
)
response.status_code = 503
response.headers['Retry-After'] = '30'
return response
active_connections += 1
@app.teardown_request
def release_connection(exception=None):
global active_connections
with lock:
active_connections = max(0, active_connections - 1)
HTTP 500 is a generic server error that usually indicates a bug in the application code. HTTP 503 means the server is temporarily overloaded or under maintenance and will recover without code changes. 500 requires a fix; 503 requires waiting.
Not if used correctly. Google treats 503 as temporary and will return to crawl the page later. Using 503 with a Retry-After header during maintenance preserves your search rankings. Prolonged 503 errors, however, may eventually cause Google to drop pages from the index.
Use 503 when the server itself is overloaded and cannot handle more requests. Use 502 when a reverse proxy or gateway cannot reach the backend server. 503 is about capacity, while 502 is about connectivity.
Include a clear message that the site is under maintenance, an estimated return time, a link to a status page if you have one, and the Retry-After header for programmatic clients. Keep the page static so it does not depend on the application server.
Google recommends keeping 503 maintenance windows as short as possible. For planned maintenance under a few hours, there is minimal SEO impact. Extended outages lasting days may cause Googlebot to reduce crawl rate or temporarily drop pages.
Get instant alerts when your endpoints go down. 60-second checks, free forever.
Start Monitoring Free →