HTTP 502 Bad Gateway — What It Means

What HTTP status code 502 Bad Gateway means, when servers return it, and how to handle it correctly.

Published September 26, 2026

HTTP 502 Bad Gateway — A gateway or proxy server received an invalid response from an upstream server.

Key points

  • Means a server acting as a gateway or proxy (like Nginx in front of an app server) got an invalid upstream response
  • Common causes: the backend application crashing, or an upstream server being completely down
  • Check the application server's logs, not just the proxy's, to find the root cause
More HTTP articles