What is the practical difference between HTTP 500, 502, 503 and 504?
Answer
500 is a generic failure in the responding server. 502 means a gateway or proxy received an invalid response from an upstream service. 503 means the service is temporarily unavailable, commonly because of overload or maintenance and it may include Retry-After. 504 means a gateway or proxy timed out waiting for an upstream service. The distinction helps a tester decide whether to investigate application logic, service availability, or an upstream dependency path.
Strong answer includes
- 500 local/general server failure
- 502 invalid upstream response
- 503 unavailable versus 504 upstream timeout
Practical example
The public API returns 504 after exactly 30 seconds while the downstream report service shows slow requests. That points toward a gateway timeout on the dependency path rather than treating every 5xx as the same backend bug.