Guide

What Does 502 Bad Gateway Mean? (Causes & How to Fix It)

7 min read · Updated August 7, 2026

You tried to open a page and got a blunt message: 502 Bad Gateway. It's one of the most common server errors on the web, and the good news is it's usually temporary and not caused by anything you did. Here's exactly what a 502 means, why it happens, and how to fix it — whether you're a visitor who just wants the page to load or the owner of the site throwing the error.

What a 502 Bad Gateway error actually means

A 502 is a server-side status code (the 5xx family always means the problem is on the server, not your device). Specifically, it means one server, acting as a gateway or proxy, received an invalid response from another server it was relying on to fulfill your request. Modern sites rarely run on a single machine — a request usually passes through a load balancer, reverse proxy, or CDN before reaching the application server behind it. When that upstream server replies with something broken, empty, or not at all, the front-facing server gives up and returns a 502.

In plain terms: the site is reachable — it answered you — but the machine it depends on to actually build the page didn't cooperate. That's different from a 404 (page not found) or a 503 (server temporarily unavailable or in maintenance).

The most common causes of a 502

The upstream server crashed or is overloaded. The most frequent cause. If the application or backend server behind the proxy is down, stalled, or buried under traffic, it can't return a valid response — so the gateway serves a 502.

A bad deploy or a code error. A broken release, a crashed process, or a script that errors out can stop the backend from responding correctly.

Server timeouts. If the backend takes too long to respond, the proxy times out the connection and returns a 502 rather than waiting forever.

CDN or proxy misconfiguration. Services like Cloudflare sit in front of your site; a misconfigured origin, firewall rule, or DNS setting can break the link between the CDN and your actual server.

Resource limits on cheap hosting. Budget shared hosting caps memory and processes. Hit the ceiling and the backend gets killed, producing intermittent 502s.

If you're a visitor: how to fix a 502

A 502 is on the site's end, so your options are limited — but a few are worth trying:

Refresh after a moment. Because 502s are often momentary, waiting 30 seconds and reloading fixes it much of the time.

Confirm it's the site, not you. Run the address through WebsitePulseCheck. If our server-side check also sees the error, it's the site — all you can do is wait. If we see it as up, the problem may be local to your network or a cached error page.

Clear your cache or try another network. Reload without cache (Ctrl+Shift+R / Cmd+Shift+R), or switch to mobile data to rule out a local hiccup. A related "this site can't be reached" message is a different problem — see our guide on fixing connection errors.

If you own the site: how to fix a 502

Check whether your backend is running. Confirm your application server (PHP-FPM, Node, etc.) is up and hasn't crashed. Restarting the backend service clears a surprising number of 502s.

Review recent changes. If the 502 started right after a deploy or plugin update, roll it back. A single bad release is one of the most common triggers.

Look at your logs and timeouts. Server and proxy logs usually point straight at the cause — an out-of-memory kill, a crashed worker, or a request that exceeded the gateway timeout. Raising timeouts or adding memory often helps.

Check your CDN/proxy and origin. If you use Cloudflare or similar, confirm the origin server is reachable and firewall rules aren't blocking it.

Upgrade underpowered hosting. If 502s keep appearing under normal traffic, your plan is simply too small. Moving to hosting with more memory, better process management, and room to scale is the permanent fix — see the recommended hosts below.

Catch 502s before your visitors do

The worst way to learn about a 502 is a customer telling you the site is broken. Set up uptime monitoring so you're alerted within minutes of the first error — the tools recommended below check your site around the clock and message you the moment it starts returning a 502, so you can fix it before it costs you traffic or sales.

Tired of Downtime? Switch to Reliable Hosting

Disclosure: some links below are affiliate links. If you sign up through them we may earn a commission at no extra cost to you. We only list tools we believe are genuinely useful.

Hostinger

Best value

Fast, beginner-friendly hosting with free SSL and a low starting price. A solid first move if your current host keeps going down.

Visit Hostinger

Bluehost

Best for WordPress

Officially recommended by WordPress, with 1-click installs and 24/7 support. Popular for blogs and small business sites.

Visit Bluehost

SiteGround

Best support

Excellent uptime and support with strong performance features and daily backups. A reliable step up from budget hosts.

Visit SiteGround

Cloudways

Best performance

Managed cloud hosting on top of providers like DigitalOcean and AWS — great when you need speed and room to scale.

Visit Cloudways

Kinsta

Best premium managed

Premium managed WordPress hosting on Google Cloud, with excellent uptime, speed, and expert support. The upgrade when reliability really matters.

Visit Kinsta

A2 Hosting

Best raw speed

Speed-focused hosting with Turbo servers and NVMe storage. A strong pick if slow load times are your main complaint.

Visit A2 Hosting

Disclosure: some links below are affiliate links. If you sign up through them we may earn a commission at no extra cost to you. We only list tools we believe are genuinely useful.

UptimeRobot

Best free plan

Monitors up to 50 sites free with 5-minute checks and email alerts. The easiest place to start if you want hands-off monitoring for your own site.

Visit UptimeRobot

Better Stack

Best alerting & status pages

Fast checks, on-call scheduling, incident management, and beautiful hosted status pages. A strong pick for teams that need to be paged the moment something breaks.

Visit Better Stack

Pingdom

Best for performance insight

Real-user and synthetic monitoring with detailed page-speed and transaction checks. Well suited to businesses that care about performance as much as uptime.

Visit Pingdom

StatusCake

Best value for growing sites

Uptime, SSL, domain, and page-speed monitoring with a generous free tier and affordable paid plans as you scale.

Visit StatusCake