WordPress 502 Bad Gateway Error: Who Failed, Fix

WordPress 502 Bad Gateway? Learn which server failed using MDN and Cloudflare rules, look up any 5xx code with our free tool, and know what to ask your host.

Share this post
7 min read

Last updated December 2, 2026

Your WordPress site shows “502 Bad Gateway”. It may last a few seconds, or it may not go away.

A 502 means one server asked another for your page and got a broken reply. The question is which server failed.

This guide answers that, then shows what you can fix and what to ask your host.

Key Takeaways

  • A 502 means a proxy got an invalid reply from the server behind it, MDN says.
  • It is almost always a server problem, not your computer or connection.
  • A Cloudflare-branded 502 page means your own server failed, Cloudflare says.
  • Short 502s that clear on reload often mean PHP restarted or ran out of workers.
  • Ask your host for the PHP error log. It shows the exact cause.
Your content is safe. A 502 error does not delete anything. Visitors just cannot reach the page for now.

Find Your Fix

Start with what the error page looks like. That tells you who failed.

502 fix finder

Answer two questions. The finder tells you which server failed and who can fix it. It runs in your browser only.

Digieh tool. Based on MDN and Cloudflare docs, read December 2, 2026.

What Does 502 Bad Gateway Mean?

MDN’s 502 reference says a server acting as a gateway or proxy got an invalid response from the upstream server.

On a WordPress site, the gateway is often Nginx, a load balancer or Cloudflare. The upstream server runs PHP, which builds your pages.

If PHP crashes, restarts or sends half a reply, the gateway shows 502. If PHP sends nothing at all in time, MDN says the gateway shows 504 instead.

Look Up Any Server Error Code

Seeing a different number? The explainer covers the common server codes. It uses Cloudflare’s 5xx error list and MDN.

Server error code explainer

Type the error number you see. Works for 500 to 504 and Cloudflare 520 to 526.

Your explanation appears here.

Digieh tool. Runs in your browser only. Based on MDN and Cloudflare docs, read December 2, 2026.

Which Server Failed?

What you seeWho failedWho can fix it
Cloudflare-branded 502 pageYour origin serverYou or your host
Plain 502 page, Cloudflare in useCloudflareUsually clears, check status
Host-branded 502 pagePHP behind the host proxyYour host
502 only during importsPHP ran out of time or memoryYou and your host

Based on Cloudflare docs on 502 and 504 errors and MDN. Last two rows are Digieh’s reading.

Editor’s Note

This guide is accurate as of Digieh check. Cloudflare says its branded 502 page means your own server failed. A plain page with no branding means Cloudflare had the problem. Many people assume the opposite.

Spot an error in this article? Please contact us at support@digieh.com or read our Corrections Policy.

Free updates

Join the Digieh list

Be the first to know when our weekly brief launches.

No spam. Unsubscribe anytime. Read our Privacy Policy.

What Can You Try First?

  1. Wait a minute and reload. Short 502s often clear when PHP restarts.
  2. Try another browser or device to rule out your cache.
  3. Check your host’s status page for outages.
  4. If you use Cloudflare, check its status page too.

If the 502 stays, move on to the server checks below.

Also ask a friend in another city to open the site. If it loads for them, the problem may be one route or proxy near you.

Write down every step you try. It helps your host skip the basics and find the real cause faster.

1 logThe PHP error log is the fastest way to find the cause. Your host can share it.

What caused your WordPress 502 error?

  • Host or PHP problem
  • A heavy plugin
  • Cloudflare or proxy
  • It fixed itself
  • Not sure

Can Cloudflare Settings Cause a 502?

Sometimes. Cloudflare’s docs note that unbranded errors can come from compression problems on your server.

  • Check the Cloudflare status page for incidents in your region.
  • Pause Cloudflare briefly, if you can, to see if the site loads directly.
  • Ask your host whether compression settings changed recently.

A plain 502 page while Cloudflare is active often clears within minutes. If it lasts, contact Cloudflare support with the time and page.

Can a Plugin Cause a 502?

Yes. A plugin that runs a slow query or uses too much memory can crash PHP. The gateway then reports 502.

  1. Rename the plugin you added or updated last in wp-content, plugins.
  2. Reload the site.
  3. If it works, update or replace that plugin.
  4. If not, rename the whole plugins folder for a quick test.

Memory crashes often show other errors too. See our WordPress memory exhausted guide.

How Is 502 Different From 500 and 504?

These three codes look alike but point to different problems.

  • 500 Internal Server Error: WordPress or the server itself hit an error. See our WordPress 500 error guide.
  • 502 Bad Gateway: a proxy got a broken reply from PHP or the server behind it.
  • 504 Gateway Timeout: the proxy got no reply in time, usually because a task was too slow.

Knowing the exact code saves time. Your host will ask for it first, so note it down.

Can Nginx or PHP Settings Cause 502?

Yes, on servers you manage yourself. The web server and PHP must agree on how to talk to each other.

  • PHP service stopped or crashed and did not restart.
  • The web server points to the wrong PHP socket or port after an upgrade.
  • PHP workers are set too low for your traffic.
  • Buffers are too small for large page headers.

On shared or managed hosting, you cannot change these. Share the error time with support, and they can check.

If you run your own server, restart the PHP service first, then read its log. Most 502s on self managed servers start there.

Does a 502 Hurt Search Rankings?

A short 502 rarely matters. Search engines retry pages that fail for a moment.

Long or repeated 502s are different. If crawlers keep failing, pages can drop from search results over time.

Fix lasting 502s quickly, then check Google Search Console for crawl errors in the following days.

What Should You Ask Your Host?

Many 502 causes live on the server, where only your host can look. Give them clear details.

  • The exact time the 502 happened, with your timezone.
  • The page or action that triggered it, such as saving a post.
  • Whether it happens every time or only sometimes.
  • A request for the PHP and web server error logs for that time.

Ask whether PHP hit its worker or memory limit. On busy sites, more PHP workers or a bigger plan may be the real fix.

Why Does 502 Happen Only Sometimes?

Hosts run a fixed number of PHP workers. When all are busy, new requests wait or fail.

Traffic spikes, bots and heavy admin tasks can use up workers. A cache plugin helps by serving many pages without PHP.

Bots hammering your login page can also eat workers. Our WordPress 403 guide covers firewalls that block them.

Try this today. Save your host’s status page and support link in your bookmarks. You will need them first when a 502 hits.

Got no reply at all instead of a bad one? See our WordPress 504 Gateway Timeout guide.

Test Yourself

You see a 502 page with Cloudflare branding. Which server failed?

  1. Your own origin server
  2. Cloudflare
  3. Your laptop

Cloudflare says a branded 502 page means the error came from your origin web server.

What does a gateway send if the upstream server sends no reply at all in time?

  1. 504 Gateway Timeout
  2. 403 Forbidden
  3. 200 OK

MDN says if the gateway receives no response from the origin, it sends a 504.

Frequently Asked Questions

Is a 502 Bad Gateway my fault?

Usually not. It is a server problem, though plugins on your site can trigger it.

Will a 502 error fix itself?

Short ones often do after PHP restarts. Lasting ones need a fix.

Does 502 mean the website blocked me?

No. A block shows 403. A 502 means a server reply failed.

Can clearing my browser cache fix a 502?

Rarely. Try it once, but the cause is usually on the server.

Is 502 the same as 504?

No. A 502 is a bad reply, while a 504 is no reply in time.

Conclusion

A 502 means a server got a broken reply from the one behind it. Check the error page branding to see who failed, reload after a minute, and test plugins. For lasting 502s, give your host the time and page, and ask for the PHP error log.

Editor’s Note

This guide is accurate as of December 2, 2026. We checked MDN Web Docs and Cloudflare troubleshooting docs on that date.

Spot an error in this article? Please contact us at support@digieh.com or read our Corrections Policy.

Keep exploring

Your next read is waiting

Found this useful?

Share this post
Avatar photo

Syed Wasif Raza

Syed Wasif Raza is the founder and editor of Digieh. He writes about health, food, lifestyle, news and sports in plain, easy English. Every guide he publishes is checked against official sources such as government and health agency pages. Connect with him on LinkedIn.

Articles: 934

Leave a Reply

Your email address will not be published. Required fields are marked *