502

Bad Gateway

5xx · Server Error

The server received an invalid response from an upstream server.

What does HTTP 502 Bad Gateway mean?

A server acting as a gateway or proxy received an invalid response from an upstream server. It usually points to a problem between servers rather than the client.

5xx responses indicate the server failed to fulfil a valid request. The problem is on the server side and is not something the client can fix by changing the request.

Common causes

  • The upstream/origin server is down or crashing
  • Misconfigured reverse proxy or load balancer
  • Firewall blocking the upstream response

How to fix a 502 error

  • Check that the origin server is running and healthy
  • Verify proxy/load-balancer upstream configuration
  • Inspect upstream timeouts and error logs

Related 5xx status codes

Look up and search every HTTP status code in one place.

Open the HTTP Status Code tool