502 Bad Gateway
A 502 is one server tattling on another.
Bad Gateway means the front-door server (usually nginx or a CDN) asked the application server behind it for your page and got garbage or silence back. The finger-pointing is built into the error — the diagnosis is figuring out which server deserves it.
Same-day diagnosis. Flat quote before any fix.
What’s actually happening
Modern hosting is a relay: a proxy or CDN out front, PHP or an app server behind it. A 502 means the handoff failed — the backend crashed, restarted, timed out hard, or answered in a way the front couldn't parse. Unlike a 500 (the app erred while running), a 502 often means the app never got to run at all.
That distinction decides ownership: intermittent 502s under load are usually the host's capacity or a crashing PHP process; constant 502s after a change are usually that change; 502s only through a CDN like Cloudflare, while the origin loads fine, point at the CDN handshake — SSL modes and timeouts between the layers.
The usual causes, ranked
After twenty-seven years of these calls, the odds are well mapped. Start at the top.
The backend process crashed or is restarting
PHP-FPM died, ran out of workers, or is cycling. The front door knocks; nobody's home. The classic intermittent 502.
Host capacity or a noisy neighbor
On shared hosting, the backend pool is shared too — someone else's traffic spike can 502 your site. Timing correlates with hours, not your changes.
CDN-to-origin handshake problems
Cloudflare or another CDN can't talk to your origin — SSL mode mismatches, origin timeouts, blocked IPs. The tell: site fine when you bypass the CDN.
A deploy or config change
New code, changed PHP versions, or a bad proxy config landed right before the 502s began. The timeline is the confession.
What you can safely try first
Nothing below can make things worse — that’s the selection criterion. Anything riskier belongs in professional hands, on a backup.
- 1
Refresh once, then note the pattern
Constant or intermittent? Everywhere or one page? 502s that come and go under load speak capacity; constant ones speak breakage. The pattern is half the diagnosis.
- 2
Check your host's status page
502s are the error most likely to be genuinely their outage. Two minutes of checking beats an hour of self-blame.
- 3
If you use Cloudflare, note whether it names itself
Cloudflare's branded 502 page means the CDN-origin handshake — a specific, fixable configuration conversation, not a mystery.
Stop and call when…
- 502s are intermittent under traffic and the host says all is well — capacity forensics with evidence is the fix
- It started after a deploy or PHP change and the rollback isn't obvious
- The CDN handshake needs SSL-mode surgery you haven't done before
From there it’s our job: same-day look, flat quote, and the $229 flat repair covers most cases of exactly this.
Single Error Fix — buy it now, skip the hunt.
One error, hunted down and fixed — 500s, white screens, redirect loops, broken pages.
Covers one specific error or broken behavior on one site. Diagnosis, the fix, and a plain-English note on what happened. If we can't fix it, you get a full refund.
Questions we hear a lot.
Is a 502 my fault or my host's?
Genuinely could be either — that's what makes it the finger-pointing error. Rough split: intermittent-under-load leans host; constant-after-a-change leans you (or whoever changed things); CDN-branded leans configuration between the layers. We diagnose with evidence so the right party fixes it — and we talk to hosts with logs in hand, which changes those conversations.
Is my site down during a 502?
Effectively yes for affected visitors — they get the error page, not your site. Intermittent 502s are sneakier: most visitors get through, some bounce off, and analytics quietly sags without an obvious outage. Worth fixing at down-site urgency either way.
What does the flat fix cover?
The diagnosis with evidence (whose layer, what mechanism), the fix where it's in your stack — config, PHP workers, CDN handshake — or the documented escalation to your host where it's theirs, pursued until resolved. $229, refunded if we can't get it sorted.
Related symptoms & help
Errors travel in packs. If this one visited, check its friends.
Find out which server deserves the finger.
Send the symptom, get a same-day look and a flat quote from the developer who's fixed this exact thing more times than either of us can count.