Skip to main content
apiguide.dev

HTTP 502 — Bad Gateway

An upstream server returned an invalid response to the gateway proxy.

Status CodeHTTP 502
CategoryServer Error (5xx)
API Error Subtypes0 error schemas
HTTP Headers0 headers

What does HTTP status code 502 mean?

The 502 Bad Gateway status code indicates that the proxy server or gateway received an invalid or empty response from the backend application process.

When to use it in APIs

Typically generated by Nginx, Cloudflare, or AWS ALBs when the backend application node (e.g., Node.js, Python, or Go process) crashes, returns invalid headers, or is offline.

How it compares to other codes

  • 504 Gateway Timeout: The backend responded but took too long. 502 indicates the backend responded with garbage or terminated the connection immediately.

Specific API Error Types for 502

No specific Problem+JSON schemas have been defined for HTTP 502 on apiguide.dev yet.

Associated HTTP Headers

No specific HTTP headers are explicitly linked to HTTP 502 in our directory yet.

Related HTTP Status Codes