Free tools

HTTP 502 Bad Gateway

A proxy got an invalid response from the upstream server. Free reference, no signup.

502 Bad Gateway

MeaningA proxy got an invalid response from the upstream server.
WhenThe gateway could not get a valid reply from the app.
CausesThe app crashed mid-response, a bad upstream header, or a connection reset.
FixCheck the app process and the proxy error log. The gateway is telling you the upstream failed.
RetryRetry idempotent requests. A storm of retries can make the outage worse.
Alert?Yes. A 502 means the thing behind the proxy is unhealthy.

Runs in your browser. Nothing you enter is stored.

Get pinged when your API starts returning 502s

A 502 means the thing behind the proxy is unhealthy.

curl -sS -X POST https://api.trigv.com/v1/events \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TRIGV_API_KEY" \
  -d '{"channel":"ops","title":"HTTP 502","level":"error"}'

How to use it

  1. Read what 502 means before changing a retry loop.
  2. Check the common causes against the response body and the server log.
  3. Follow the retry note. Retrying a 400 with the same body will fail again.
  4. If this is your API, use the snippet to hear about it.

About this tool

HTTP 502 Bad Gateway means A proxy got an invalid response from the upstream server. Servers send it when The gateway could not get a valid reply from the app.

Common causes: The app crashed mid-response, a bad upstream header, or a connection reset. The practical fix is: Check the app process and the proxy error log. The gateway is telling you the upstream failed.

Retry: Retry idempotent requests. A storm of retries can make the outage worse.

Alert on it? Yes. A 502 means the thing behind the proxy is unhealthy.

Trigv is a push for the moment a status starts mattering, not a log of every response. If the code is one you should hear about, the snippet posts a single event with level error or warning. The status page itself does not call your API.

Questions

What is HTTP 502?

A proxy got an invalid response from the upstream server.

Should the client retry?

Retry idempotent requests. A storm of retries can make the outage worse.

Should I alert on it?

Yes. A 502 means the thing behind the proxy is unhealthy.

How is this different from reading the spec?

The page adds a plain retry note and an alert verdict for people running the service, not only for people parsing the response.