| Previous | Next |
| HTTP_STATUS_BAD_GATEWAY | HTTP_STATUS_GATEWAY_TIMEOUT |
HTTP_STATUS_SERVICE_UNAVAIL
HTTP_STATUS_SERVICE_UNAVAIL represents HTTP 503 Service Unavailable. The server is currently unable to handle the request because of a temporary condition such as overload or scheduled maintenance. It is a server-side availability status; it does not mean that a gateway received an invalid upstream response, which is the separate 502 Bad Gateway condition.
Retry-After and temporary failure
A 503 response can include Retry-After to suggest how long the client should wait before making another request. The field is optional, and RFC 9110 also notes that an overloaded server is not required to send 503 at all: it can simply refuse connections or fail before producing an HTTP response. Therefore, absence of 503 does not rule out overload.
For diagnosis, first identify the component that emitted the status. An origin application, reverse proxy, load balancer, or maintenance layer can each generate 503 for different local reasons. Correlate the response time with worker or connection limits, request queues, dependency health, deployment or maintenance events, and upstream availability. Inspect Retry-After and cache-control fields before designing automatic retries.
503 versus 502
Use the distinction to narrow the failure path. A 503 says the responding server cannot currently service the request. A 502 says a server acting as a gateway or proxy received an invalid response from an inbound server. Replacing one with the other in logs or error handling hides which HTTP role detected the failure.
References
- RFC 9110, 503 Service Unavailable — temporary availability semantics and optional
Retry-After. - RFC 9110, 502 Bad Gateway — the distinct gateway/upstream-response failure.
- RFC 9110, Retry-After — delay information for later requests.
Looking for a different code? Search another status or error code.