HTTP Error Code 502
A gateway or proxy received an invalid response from an upstream server.
A gateway or proxy received an invalid response from an upstream server.
| Code | 502 |
| Product | HTTP |
| Company / origin | IETF / IANA · International standard |
| Category | Protocols & Standards |
| Platform / versions | HTTP/1.1, HTTP/2, HTTP/3 · All HTTP versions |
| Severity | error |
| Official source | RFC 9110: HTTP Semantics ↗ |
| Last verified | 2026-11-08 |
What does HTTP error 502 mean?
HTTP 502 means the server acting as a gateway could not use the response it received from the upstream application or service. The upstream may have crashed, closed the connection, returned malformed headers, or spoken the wrong protocol.
Common causes
- The upstream application process is down or restarting.
- The upstream returned an invalid response, timed out mid-response, or reset the connection.
- A proxy or load balancer points to the wrong port or protocol.
How to fix it
- Step 1
Check the upstream service health and recent restarts.
- Step 2
Inspect the gateway error log for the upstream address and failure reason.
- Step 3
Verify that the proxy target port, protocol, and health check match the application.
When to escalate
Related codes
| Code | Name | What it means |
|---|---|---|
504 | Gateway Timeout | A gateway or proxy did not receive a timely response from an upstream server. |
400 | Bad Request | The server cannot process the request because the syntax or parameters are invalid. |
401 | Unauthorized | Authentication is missing, expired, or invalid. |
403 | Forbidden | The server understood the request but refuses to authorize it. |
404 | Not Found | The requested resource does not exist at this URL. |
Source & verification
This page was checked against RFC 9110: HTTP Semantics on 2026-11-08. The code, product, and platform fields are kept separate from the explanation so corrections can be made without changing the URL.
Open Error Codes is independent and not affiliated with IETF / IANA. Always confirm destructive or security-sensitive steps with the official documentation.