The 502 Bad Gateway

Close-up of the exposed silicon die of an old computer processor
Layer
4. The Kernel Core
Type
FINAL BOSS
Uptime
9,999
Latency
Timeout
Threat Level
★★★★★

Lore

At the very bottom of the Deep Stack, where the Kingdom of Localhost meets the Wild Internet, stands the 502 Bad Gateway. It is a towering stone door carved with three terrible digits. It was once the Realm’s loyal gatekeeper, passing every request down to the servers below and every answer back up. Then the Great Outage silenced the servers behind it. The Gateway still stands guard, but it receives nothing, so it lets nothing through. To every traveler it gives the same cold answer, in plain gray text: 502 Bad Gateway.

Here is the Gateway’s secret: it is not the real enemy. It is only reporting that something behind it has fallen. Smash the door all you like; it will rebuild itself until the upstream servers live again.

How to defeat it

Restore the upstream servers, then restart the gateway. Defeat this boss and the Sacred SLA is restored. The 99.99% seal holds, and the Realm of Uptime is saved, at least until the next on-call rotation.

Real-world tip: A 502 Bad Gateway means a server in front, such as a proxy, load balancer or CDN, asked the server behind it for a page and got no valid answer. The real fault is usually upstream: PHP crashed or timed out, the server is overloaded, or a long-running request hit a limit. Check error logs for PHP crashes or timeouts and look for slow plugins or heavy traffic. On WP Engine, check wpenginestatus.com for platform issues and contact WP Engine Support if the cause isn’t clear.