See the difference between 500, 502 and 503 as animated request→response flows. App crash vs gateway failure vs overload, plus what Retry-After means.
Scenario
Requests
3
Current step 9/9
503's point is 'temporary'. Respect Retry-After and retry later. 500/502/503 share 'not the client's fault', but the cause and retry semantics differ.
Arrow color = status class. The key redirect pair: 301 is 'permanent', 307 'keeps the method'. Notice how cheap the second request is when the cache validates (304).
All status codes
1xx Informational
2xx Success
3xx Redirection
4xx Client error
5xx Server error
All 5xx codes mean 'your request was fine — the server failed'. That's the mirror image of 4xx ('you sent it wrong'), which is why a client receiving 5xx can meaningfully retry, and why servers should be alarming on them.
The three codes differ in where the failure sits. 500 is the app code itself blowing up — an unhandled exception, the classic 'generic error'. 502 means a proxy or gateway (nginx, Cloudflare, a load balancer) failed to talk to the upstream app server — the middle layer broke, not your request. 503 means the server is alive but 'can't take it right now' — overload or maintenance.
Retry semantics differ too. 500 probably fails again until the code is fixed; 502 clears the moment the upstream recovers; 503 may even tell you when to come back via the Retry-After header. Under traffic spikes, 503 + Retry-After is the standard valve that stops clients from stampeding a struggling server. HTTP Status Playground