What is a 502 Bad Gateway error?
Modern websites are rarely one machine. A request passes through a CDN, a load balancer or a reverse proxy before it reaches the application server that builds the page, and each layer depends on the one behind it. A 502 is what the front layer says when the layer behind it answered with something it could not use: a timeout, a crash, a malformed response, nothing at all. The gateway is fine; the thing it was waiting for is not.
It belongs to the 5xx family, the codes that mean the fault is on the server side. The visitor did everything right and the site still could not deliver.
Why it matters
Why a 502 Bad Gateway error matters
Downtime, first. Every minute a site returns 502 is a minute of lost visitors, failed campaign clicks and paid media spent on an error page. On a launch day, when traffic spikes are exactly what you planned for, an application server that cannot keep up is the most common reason the launch page shows a 502 to the audience you paid to bring.
Search, second. Google treats 5xx errors as temporary at first and keeps the page indexed, but a site that returns them for an extended stretch starts to lose rankings as the crawler slows down and, eventually, drops pages it cannot reach. A brief outage is forgiven; a week of intermittent 502s is not.
In practice
How a 502 Bad Gateway error works in practice
- 01
Find the layer. A 502 from a CDN means the origin server is not responding; a 502 from the origin's own proxy means the application behind it is down or overloaded. Hosting dashboards, server logs and the status page of the CDN show which it is. Common causes are a PHP or Node process that crashed, a database that stopped answering, a deploy that half completed, or a traffic spike that exhausted the server's capacity.
- 02
Plan for it before the launch. Load-test the page you are sending traffic to, cache it at the CDN so the origin is not building it fresh for every visitor, and have someone who can restart services on call for the first hours. A 502 during a campaign is almost always a capacity question that could have been answered in advance.
Watch out
What people get wrong about 502 Bad Gateway errors
Treating it as a Google problem. A 502 is an infrastructure problem, and the SEO cost is a symptom. The fix is in hosting, caching and capacity, not in the marketing stack. The other mistake is dismissing an intermittent 502 because the site looks fine when you check it: the errors are happening to other people, between your visits, and the server logs will show them.
Having no error page. When the gateway cannot reach the origin, the visitor should still see something branded that says the site will be back, not a bare line of server text. Most CDNs let you host that page at the edge so it works even when nothing else does.





