IT Toolbox
Menu
HomeHTTP 502 — Bad Gateway
Error code

HTTP 502 — Bad Gateway

HTTP 502 Bad Gateway occurs when a gateway or reverse proxy cannot obtain a valid response from an upstream server.

TopicComputer error codes → About 1 min read

HTTP 502 — Bad Gateway

Category: HTTP | Priority: High

What does HTTP 502 Bad Gateway mean?

A reverse proxy or gateway received an invalid upstream response or could not establish a valid connection to an application server.

Likely causes of HTTP 502

  • Application backend unavailable or refusing connections
  • Wrong upstream host, port or HTTP/HTTPS protocol
  • Broken TLS negotiation or name resolution
  • Unexpected connection resets or malformed upstream responses

How to diagnose and fix HTTP 502

  1. Capture the affected URL, timestamp and request identifier.
  2. From the proxy, test the backend host, port and HTTP/HTTPS protocol.
  3. Correlate reverse-proxy errors with application and network logs.
  4. Review recent configuration or certificate changes, then correct the root cause.
  5. Retest the full request path and confirm a valid upstream response.

Preserve logs before restarting services. Do not expose internal URLs, access tokens or passwords in screenshots.

Return to the HTTP error code reference.

HTTP 502 vs 504: what is the difference?

A 502 usually indicates an invalid or unusable upstream response. A 504 indicates the upstream server did not respond before the configured timeout. Both may involve a reverse proxy, but their diagnosis differs.

Support the development of BAOI Hosting, domains and new IT resources.
❤️ Support BAOI

My favorites