What does HTTP status 502 (Bad Gateway) mean?

 
Previous Next
HTTP_STATUS_NOT_SUPPORTED HTTP_STATUS_SERVICE_UNAVAIL

HTTP_STATUS_BAD_GATEWAY

The failing component is usually between the client and the application: reverse proxy, load balancer, API gateway, or CDN. The upstream can be unavailable, speak the wrong protocol, reset the connection, or return malformed data.

Compare proxy and upstream logs using the same request ID. Check upstream address, TLS settings, health checks, timeouts, and response framing before changing the client request.

Troubleshooting should separate proxy health from origin health. Check whether the intermediary can resolve and connect to the configured upstream, whether the upstream closes the connection prematurely, and whether TLS or protocol expectations match on both sides. Repeating the same client request will not repair a persistently broken upstream path.

RFC 9110: HTTP Semantics


Looking for a different code? Search another status or error code.