HTTP Status Codes

503 503 Service Unavailable

The server is temporarily unable to handle the request, typically due to maintenance or overload.

What Is This?

The HTTP 503 Service Unavailable status code indicates that the server is temporarily unable to handle the request. This is typically a temporary condition that may be resolved after some delay. Common causes include server overload from traffic spikes, scheduled maintenance, or rate limiting at the infrastructure level. Unlike 500 (unexpected error), 503 is usually expected and planned for.

Common Causes & Solutions

1

Common Cause

Server overload from unexpected traffic spikes

2

Common Cause

Scheduled maintenance or deployment in progress

3

Common Cause

Application server restarting or scaling up

4

Common Cause

Database connection pool exhausted

5

Implement health check endpoints

Create a /health endpoint that checks all dependencies (DB, cache, external APIs) and returns the server status.

// Express.js health check endpoint
app.get('/health', async (req, res) => {
  const health = {
    status: 'ok',
    timestamp: new Date().toISOString(),
    uptime: process.uptime()
  }
  
  try {
    await db.raw('SELECT 1')
    health.database = 'connected'
  } catch (err) {
    health.database = 'disconnected'
    health.status = 'degraded'
  }
  
  res.status(health.status === 'ok' ? 200 : 503).json(health)
})
6

Use Retry-After header

Include Retry-After in 503 responses to tell clients when to retry, reducing thundering herd problems.

HTTP/1.1 503 Service Unavailable
Retry-After: 120
Content-Type: application/json

{
  "error": "Service Unavailable",
  "message": "The server is undergoing maintenance. Please try again in 2 minutes."
}

Related Entries

More from this reference:

Frequently Asked Questions

How long should a service stay unavailable?

503 is for temporary conditions — seconds to hours. If a service will be down for more than a day, consider serving a static maintenance page with a 503 status and a clear explanation.

Does 503 affect SEO?

Yes, if a page consistently returns 503, search engines may assume it is permanently unavailable. Use 503 only for genuine temporary outages. For permanent pages, use appropriate redirects or remove the URL from sitemaps.