5xx Server ErrorCommonly usedRFC 9110
503Service Unavailable
Server is temporarily unavailable — overloaded or down for maintenance.
What it means
The server is temporarily unable to handle the request due to maintenance or overload. This is usually a temporary condition. Include a Retry-After header when the downtime is known.
When to use it
- ✓Planned maintenance window
- ✓Server is overloaded and shedding load
- ✓Deploying updates (brief downtime)
- ✓Database is temporarily unavailable
Code Examples
Express — maintenance mode
javascript
const MAINTENANCE = process.env.MAINTENANCE_MODE === 'true';
app.use((req, res, next) => {
if (MAINTENANCE) {
return res.status(503)
.set('Retry-After', '3600')
.json({
error: 'Service Unavailable',
message: 'Scheduled maintenance until 14:00 UTC',
});
}
next();
});Quick Facts
Code503
CategoryServer Error
SpecRFC 9110
CommonYes
Relevant Headers
Retry-After
Date or seconds until service is expected to be available