Back to httpstatuses.net

500 vs 502 vs 503 vs 504 Server Errors

All four are server-side failures, but they point to different layers of the system.

Status codes in this guide

Quick comparison

CodeWhere to look firstMeaning
500Application logsThe origin server hit an unexpected error.
502Proxy and upstream logsA gateway received an invalid upstream response.
503Capacity and maintenance stateThe service is temporarily unavailable.
504Timeouts between proxy and upstreamA gateway waited too long for the upstream response.

Questions

Is 502 a client problem?

Usually no. 502 normally indicates a proxy, gateway, or upstream server problem.

Should clients retry 503?

Clients may retry 503 if the request is safe and the server provides Retry-After or documented backoff guidance.

Describe the error response body

After choosing the status code, use the RFC 9457 Problem Details guide when the API needs a standard JSON error body.


HTTP status code lookup
REST API status code chooser
cURL command generator
By Ping Now, a website/API/service uptime monitor
Data from Wikipedia