Creative agency glossarySEO and Analytics

502 Bad Gateway

A 502 Bad Gateway error means one server in the chain that delivers your site received an invalid response from another, so the page could not be served.

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

  1. 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.

  2. 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.

Questions

People also ask

What causes a 502 Bad Gateway error?

A server in front (a CDN, load balancer or proxy) got an invalid response, or no response, from the server behind it. Typical causes are a crashed application process, an unresponsive database, a failed deploy, a misconfigured proxy or a traffic spike the origin cannot handle.

Does a 502 error affect SEO?

Briefly, no; Google treats 5xx errors as temporary and keeps the page indexed. Over days or weeks, yes: crawling slows, and pages that keep failing are eventually dropped from the index until they return.

How do I fix a 502 Bad Gateway error on my website?

Check the hosting status and server logs to find which layer failed, restart the application or database service, and roll back a recent deploy if the timing matches. If it happens under load, add caching at the CDN and increase the origin's capacity before the next spike.

Next to it in the glossary

  1. 404 Not FoundA 404 Not Found error is the response a web server returns when a requested page does not exist, which harms search visibility and user trust unless it is handled with a redirect or a useful custom page.
  2. 410 GoneA 410 Gone status tells browsers and search engines that a page has been removed on purpose and is not coming back.
  3. 500 Internal Server ErrorA 500 Internal Server Error is the HTTP status code a web server returns when it has failed to handle a request for a reason it cannot specify, and the page does not load.
  4. A/B TestingA/B testing is a controlled experiment that shows two versions of an ad, a page or a message to similar audiences and measures which one performs better.
  5. Accelerated Mobile Pages (AMP)Accelerated Mobile Pages (AMP) is an open-source framework from Google for building stripped-down web pages that load almost instantly on phones.
  6. AI Optimization (AIO)AI Optimization (AIO) is the practice of shaping content and its structure so that AI models and assistants understand it, trust it and cite it when they answer questions.

Every SEO and Analytics term →

In the work

Where it shows up

All our creations →

From the journal

Read around it

The journal →

Talking the talk is one thing

We make the work.

RIOT is a creative agency and production studio in New York. Strategy, brand, film, photography, design and the campaigns that carry them, made by one team. A few lines is enough to start: we read every brief the same day.

    Footage