502 Bad Gateway

All status codes
5xx · Server errorretryable

502Bad Gateway

The server was acting as a gateway or proxy and received an invalid response from the upstream server.

What this code obliges you to do

Retry

Safe to retry

Repeating the same request can succeed, so a client may back off and try again. Honour Retry-After when the response sends one.

Caching

Not cacheable by default

Caches will not store this response unless you send explicit freshness headers saying they may.

Response body

Body allowed

You may return a payload explaining the outcome — for an error, a machine-readable problem document is worth the effort.

What usually causes it

2
1

Nginx failing to connect to Node/PM2 backends

2

Docker container crash behind reverse proxy

Effect on search

Negative. Tells crawlers the proxy layer is alive but the underlying application servers are dead or inaccessible.

How to send it

1
Docker/Nginx
// Error typically thrown natively by Proxy/Load Balancers

Codes people confuse with this one

3
Class5xx
RetrySafe
CacheNo
BodyAllowed