Web hosting, domains, email and websites for local business

T3CHS Get Started

Guide

502 Bad Gateway: What It Means and How to Fix It

A 502 Bad Gateway means one server in the chain asked another server for your page and got back a broken answer. It is almost never the visitor's fault. If it is your site, the fix is on your host, your CDN or your site's code, and the fastest path is usually a short message to your host with the time, the page and what you changed.

In Short

  • A 502 comes from the middleman, like Cloudflare or your host's proxy, not from the visitor.
  • Check from your phone on cell data first. If it fails there too, it is the site.
  • Most 502s on small sites trace back to an overloaded server, a crashed plugin, a bad DNS change or an expired certificate behind a CDN.
  • Google slows its crawl on 5xx errors and drops pages that keep failing.
  • On October 18, 2026 we loaded 2,000 small business home pages. None showed a 502, but nine showed another server error, and all nine were still down when we checked again.

The Short Answer

We look after a lot of small business websites. When one of them breaks, the owner usually texts us a screenshot of a white page that says 502 Bad Gateway. Then they ask two things. Is it me? And is it bad?

Here is the plain answer.

  • It is almost never you. A 502 means a server in the middle got a bad answer from the server behind it. Your phone, your browser and your Wi-Fi are rarely the cause.
  • It is bad if it lasts. A 502 for a few seconds during a restart is normal. A 502 that lasts an hour means calls and bookings are going somewhere else.
  • The fix is upstream. Your host, your CDN or your site's code. This guide shows you how to find which one in about five minutes, without logging into a server.

What a 502 Bad Gateway Means

Most websites do not answer you directly anymore. Your visit goes through a chain.

  1. Your browser asks for the page.
  2. A front server takes the request. This can be a CDN like Cloudflare, a load balancer, or your host's own proxy.
  3. That front server asks the real web server behind it, often called the origin, to build the page.
  4. The origin sends the page back up the chain.

A 502 means step 4 went wrong. The front server reached the origin, but the answer it got back was invalid. The web standard for HTTP, RFC 9110, defines it as a server acting as a gateway or proxy that got an invalid response from the server behind it. MDN adds that the fix usually needs the server owner, except when the problem is the visitor's own network, VPN or proxy.

502 vs 503 vs 504

These three get mixed up all the time. They point to different fixes.

CodeWhat it meansWhere to look first
500 Internal Server ErrorThe site's own code crashedA plugin, theme or recent update
502 Bad GatewayThe middle server got a broken answer from the originThe origin server, its software and its certificate
503 Service UnavailableThe server says it is busy or down for upkeep, for nowTraffic spikes, a maintenance mode left on
504 Gateway TimeoutThe middle server waited and got no answer in timeA slow page, a slow database, an overloaded server

The meanings come from RFC 9110 sections 15.6.1 to 15.6.5. MDN notes that when the origin sends no answer at all, the proxy should send a 504 instead of a 502.

Is It Your Site or Just You?

Do this before you call anyone. It takes two minutes.

  1. Reload once. Wait 30 seconds and reload. Servers restart, and a short 502 during a restart is normal.
  2. Try your phone on cell data. Turn off Wi-Fi first. If the site loads on cell data but not at the office, the problem is your network, VPN or office firewall. If it fails on both, it is the site.
  3. Try a different page. Load your home page and one inner page. If only one page fails, it is that page's code, a form, a booking widget or a slow database call.
  4. Look at the error page itself. Who drew it? A page with Cloudflare's logo and three boxes means the visit reached Cloudflare and Cloudflare could not get a good answer from your server. A bare page that just says nginx or Apache came from your host's server software.

If you use Cloudflare, that last check tells you a lot. Cloudflare's own docs say a Cloudflare branded 502 or 504 means your origin server returned the error, and that this is the most common case. A blank page with no branding came from Cloudflare itself.

Cloudflare's Error 502 or 504 help page listing two possible causes, errors from your origin web server, marked most common, and errors from Cloudflare
Cloudflare's help page for 502 and 504 errors. It says most come from the origin server, not from Cloudflare. Screenshot taken October 18, 2026.

The Six Usual Causes on a Small Business Site

The top results for this error are written for engineers who run their own servers. Most small businesses do not. You have a host, maybe a CDN, maybe WordPress. So here are the causes we actually run into, and who fixes each one.

CauseWhat you might noticeWho fixes it
Server out of memory or CPUSite fails at busy times, works at nightYour host. Ask about your plan's limits
A plugin or theme crashedStarted right after an updateYou or your web person. Undo the update
DNS points to the wrong placeStarted right after you moved hosts or changed DNSWhoever runs your DNS
Expired or wrong certificate on the originWorks without a CDN, fails through itYour host. Renew or reissue the certificate
Firewall blocks the CDNOnly visitors through the CDN get errorsYour host. Allow the CDN's IP addresses
Host outageOther sites at the same host are down tooYour host. Check their status page and wait

Two of these are worth a closer look, because owners rarely suspect them.

The certificate behind the CDN. Visitors see a padlock from your CDN, so everything looks fine. But the CDN also talks to your origin over HTTPS. Amazon's CloudFront docs list an expired, invalid or self signed certificate on the origin as a cause of a 502, along with a certificate whose name does not match. Our SSL guide explains how renewals work.

The DNS change you made last week. If you moved hosts, the CDN may still be pointed at the old server, or at a name that no longer resolves. CloudFront even has its own DNS error code for this case. Our DNS records guide shows which record points where.

How to Fix It Without Touching the Server

You do not need a server login for most of this. Work down the list and stop when the site comes back.

  1. Ask what changed. A plugin update, a new theme, a DNS edit, a host move, a new firewall rule. Most 502s start within an hour of a change.
  2. Check your host's status page. Search your host's name plus status. If they list an incident, wait it out and save the time for your records.
  3. Undo the last change. Roll back the update, or restore last night's backup in your host's panel. A restore is often faster than finding the bug.
  4. On WordPress, turn off plugins. If you can reach the dashboard, deactivate plugins one at a time. If you cannot, the WordPress docs show how to rename the plugins folder in wp-content from your host's file manager. That turns them all off at once.
  5. On Cloudflare, pause it for one test. Pausing Cloudflare for the site sends visitors straight to your server. If the site works with Cloudflare paused, the problem is between Cloudflare and your server, often the certificate or a firewall. Turn it back on after the test.
  6. Message your host. If none of the above fixed it, it is their turn. Use the message below.

What to Send Your Host

Support teams fix things faster when you give them facts, not feelings. Copy this and fill in the blanks.

Our site [your domain] is showing 502 Bad Gateway. It started at [time and time zone]. It fails on [home page, or the exact page]. It fails from [office Wi-Fi and phone on cell data]. The error page is [Cloudflare branded, or plain nginx or Apache]. The last change we made was [what, and when]. Can you check the server error log for that time and tell us what the origin returned?

If you use Cloudflare, Cloudflare's docs also ask for the output of yourdomain.com/cdn-cgi/trace when you open a ticket with them. Open that address in your browser and paste what it shows.

Does a 502 Hurt Your Google Rankings?

A short one does not. A long one does.

Google says 5xx errors, which include 502, make its crawlers slow down for a while. Content from a page that returns a 5xx is ignored. Pages already in the index are kept at first, but they are eventually dropped if they keep failing. Once the server answers normally again, Google raises its crawl rate back up bit by bit. That is all on Google's page on how HTTP status codes affect its crawlers, last updated February 4, 2026.

Google's page titled How HTTP status codes affect Google's crawlers, with sections for 2xx, 3xx, 4xx and 5xx server errors
Google's page on how status codes affect its crawlers. The 5xx section explains the slowdown and when pages drop. Screenshot taken October 18, 2026.

If you take a site down on purpose, do not leave it on a 502. Google's guide to pausing a website says to return a 503 with an information page if you must disable a site for one or two days, and calls a full shutdown an extreme step for a few days at most.

So the rule for owners is simple. Minutes do not matter. Days do. If your site has thrown errors for more than a day, fix it first and then check the Pages report in Search Console. Our guide on why Google won't index your pages walks through that report.

What We Saw on 2,000 Small Business Sites

Most 502 guides explain the error. None we read showed how often small business sites are actually broken. So on October 18, 2026 we picked 2,000 independent auto repair shop websites at random and loaded each home page once, between 7:11 and 7:13 in the morning Pacific time. Then we loaded every failure again about three minutes later.

Loaded fine1,716Blocked or not found (4xx)174Domain did not resolve57Certificate error37Server error (5xx)9Timed out or cut off7502 Bad Gateway0
What 2,000 small business home pages returned when we loaded each one once. Our own check of independent auto repair shop sites, October 18, 2026.

Not one site showed a 502 in that pass. That fits what a 502 usually is, a short break during a restart or an update. But nine sites showed another server error, and every one of the nine was still failing on the second try. Here is what they were.

What the server saidSitesWhat it points to
Cloudflare 522, connection timed out2The origin server did not answer Cloudflare in time
Cloudflare 530, origin name not found1DNS behind Cloudflare is broken
500 with a WordPress critical error2A plugin or theme crashed
500 with no message1The site's code or server setup failed
503 maintenance page1A maintenance mode left on
503 from a site builder platform1The builder's own service for that site
503 bot check from the host1Not down. The host challenged our visit

Three lessons for owners.

  • Behind Cloudflare, a dead server often shows a different number. Cloudflare's 522 page says it means Cloudflare could not connect to your origin in time, often because the server is overloaded, offline or blocking Cloudflare. Its 530 page says Cloudflare could not resolve the origin's name. Same root causes as a 502, different code. Treat any 5xx the same way.
  • The broken sites stayed broken. A 502 that clears on reload is noise. A 5xx that is still there minutes later is an outage. Unless you have an alert set up, the first person to notice is usually a customer.
  • The bigger leaks were not server errors. 57 domains did not resolve at all, and 37 failed the certificate check. Those are expired domains and lapsed certificates, and they cost far more traffic than any 502. Our guides on what happens when a domain expires and on certificates cover both.

About a third of the sites, 676 of 2,000, answered through Cloudflare. If yours is one of them, learn the Cloudflare error pages. They tell you whether to call your host or check your CDN settings.

What the Top Results Get Wrong

We read the pages that rank for this error before we wrote this one.

  • They assume you have a server. The top guides start with SSH, log files and timeout settings. Most small business owners have a host panel and a support line. The first steps should be ones you can do from a phone.
  • They oversell the visitor fixes. Clearing your cache and restarting your router fill half of most guides. A 502 is a server to server failure. Those steps help only when the problem is your own network, and our phone on cell data test rules that out faster.
  • No message for the host. Not one top result told owners what to send their host. That message is the fastest fix most owners have.
  • No sense of how long is too long. Google's own docs draw the line. Short errors are fine. Errors that persist get pages dropped.

How to Stop the Next One

Most 502s cannot be stopped forever, but you can make them short and rare.

  • Get an uptime alert. A free uptime monitor checks your home page every few minutes and texts you when it fails. You hear about it before a customer does.
  • Update on a weekday morning. Never update plugins or themes on a Friday night. If an update breaks the site, you want your host's support awake.
  • Keep nightly backups you can restore in one click. Check once that the restore actually works.
  • Size the plan for your busy hour. If the site fails every Monday at 9am, you have outgrown the plan. Our guide on what hosting a small business needs helps you size it.
  • Write down who runs what. Your registrar, your DNS, your CDN, your host and their support numbers. In an outage, that list saves the first half hour.

Get Help When It Breaks

If you would rather not chase errors yourself, T3CHS offers hosting for small business sites we build. There are no plugins to break, and every version is saved, so a bad change rolls back in one step. Call or text (949) 65-T3CHS, or tell us what broke.

Common Questions

Is error code 502 my fault?

Almost never. A 502 means a server in the middle got a bad answer from the server behind it. It is only your side when your own network, VPN or proxy is the problem, so test once on your phone with Wi-Fi off.

Will error 502 fix itself?

Often, yes. A 502 during a server restart or a short spike clears in seconds or minutes. If it is still there after a few reloads over 10 minutes, something is broken and your host needs to look.

How long does a 502 Bad Gateway last?

There is no set time. Short ones last seconds. In our check of 2,000 small business sites on October 18, 2026, every site that showed a server error was still failing about three minutes later.

How do you fix a 502 Bad Gateway?

Find out what changed, check your host's status page, undo the last update or restore a backup, turn off WordPress plugins, and then send your host the time, the page and the error page type.

What is the difference between a 502 and a 504 error?

A 502 means the middle server got an invalid answer from the origin. A 504 means it got no answer in time. Both point to the origin server, but a 504 more often means something is slow.

Does a 502 error hurt SEO?

Not if it is short. Google slows its crawl on 5xx errors and ignores the content of failing pages. Pages that keep failing are eventually dropped from the index.

Sources

  1. RFC 9110: HTTP Semantics, Server Error 5xxrfc-editor.org
  2. MDN Web Docs: 502 Bad Gatewaydeveloper.mozilla.org
  3. Cloudflare Docs: Error 502 or 504developers.cloudflare.com
  4. Cloudflare Docs: Error 522developers.cloudflare.com
  5. Cloudflare Docs: Error 530developers.cloudflare.com
  6. AWS Docs: CloudFront HTTP 502 Status Code (Bad Gateway)docs.aws.amazon.com
  7. Google Crawling Infrastructure: How HTTP Status Codes Affect Google's Crawlersdevelopers.google.com
  8. Google Search Central: Pausing or Disabling a Websitedevelopers.google.com
  9. WordPress Developer Resources: Common WordPress Errorsdeveloper.wordpress.org

Last reviewed October 19, 2026.

See more of our reporting when you search.

Want T3CHS first in Google? Set us as a preferred source

Keep Reading

Put it to work

More guides

Look up a term