Responses
Server errors
Recognize internal failures, bad gateways, unavailable services, and gateway timeouts while keeping useful diagnostics out of public responses.
7 minute lesson
~~~
A 5xx status means the server failed to complete a request it should have been able to handle.
500 Internal Server Error: an unexpected application failure.502 Bad Gateway: a gateway received a bad upstream response.503 Service Unavailable: the service is overloaded or temporarily down.504 Gateway Timeout: an upstream service did not answer in time.
The response shown to a visitor should be calm and generic. Detailed diagnostics belong in server logs, connected by a request ID when possible.
When debugging, check the exact status, response body, server logs, and whether another service sits between client and application. A gateway error may not come from your application process at all.
Quick check
Result
You got of right.
Lesson completed