Causes And Steps To Fix It

The “502 unhealthy gateway” WordPress error is probably going one of many commonest errors that occur on internet sites. Fixing this error is simply not easy though, because of it could be sturdy to pinpoint the exact set off.

To work out what induced the 502 error, various choices must be tried out until you hit the bull’s-eye.

But sooner than you start with the choices, it’s fully essential that you just simply understand what the 502 error means. It’s akin to finding out what an ailment or sickness is sooner than figuring out the set off and therapy.

Let’s begin…

When you open a web page, proper right here’s what happens behind the scenes:


The browser sends a request to the web internet hosting server. Normally the server will reply with HTTP (HyperText Transfer Protocol) standing codes and the belongings (or net web page) you requested. But typically the server may reply with a 502 error. It typically happens when the server takes a really very long time to fetch the online web page.

This delay in response may need occurred on account of causes like a server topic, plugin battle, DNS, PHP factors, and so forth.

Impact of the “502 unhealthy gateway” error

The 502 error impacts your visitors as they’re unable to get the information they bought right here for. As a final result, they abandon your web page shortly.

Search engines will uncover this habits and shortly ample your rankings will drop. Needless to say, this chain of events will set off a giant dip in your revenue assortment.

Causes of “502 unhealthy gateway” error

Now that we’ve talked a bit about what a 502 unhealthy gateway error is in WordPress, let’s check out the most common causes.

1. Server factors

The server the place your web page is hosted might probably be down.


This is simply not unusual.

The web internet hosting server may need been taken offline intentionally for repairs features, like updating the server’s security system.

A web internet hosting server is a little bit of sophisticated instruments that might be damaged and require substitute or repairs. If your web internet hosting server is current course of repairs, then you definitely’re doable to see a 502 error in your web page.

There is a chance that prime web site guests to your web page induced server overload and rendered it unable to answer.

2. Poorly coded plugins and/or themes

Themes and plugins are what make WordPress so trendy. But themes and plugins are moreover the reason why a web page crashes or throws an error typically.

We have seen far too many poorly coded themes or plugins overwhelming the server which then throws a 502 error.


3. PHP timeout factors

PHP is a programming language. In fact, all plugins and themes comprise a bunch of PHP recordsdata. When you set in or change a plugin or theme, a couple of of those PHP recordsdata start working.

PHP code can run for a really very long time and use a giant chunk of your web internet hosting server’s belongings. To cease abuse of server belongings, web internet hosting suppliers put a cap on how prolonged a PHP code can run. When the code hits the prohibit, the server throws a 502 error.

4. CDN server topic

CDN (Content Delivery Network) helps make your web page sooner. Some CDNs, like Cloudflare, focus carefully on security; on account of this truth, moreover they provide firewall security.

Since a CDN sits between your web internet hosting server and the browser, any request made in your web page will first must cross by the use of the CDN.

So everytime you open your web page whereas the CDN server is down, your request will generate a 502 error.

5. Browser topic

Occasionally, browsers throw 502 errors too. This typically happens on account of a corrupt extension, like ad-blockers, corrupt cache, or outdated browser.


6. DNS error

DNS factors are unusual. They occur everytime you swap space registrars or web internet hosting suppliers. This can also occur if you find yourself establishing an web utility firewall like Cloudflare or Sucuri.

Following a migration or firewall arrange, you wish to change the DNS nameservers and degree them to your internet host. It can take as much as 24 hours for the nameservers to activate. If you open the web page all through this period, you’re going to be welcomed with a 502 error.

7. Hardware & connectivity factors

On unusual occasions, the 502 error occurs on account of {{hardware}} or broadband connectivity factors. Most of the time, it’s a brief lived glitch.

That’s all, folks!

How to remove the “502 unhealthy gateway” WordPress error out of your web page?

Now that you just’ve bought an idea of what might probably be inflicting the “502 unhealthy gateway” error, let’s check out various the attainable choices.

⚠️ We counsel: Make a backup of your complete web page. In the subsequent tutorial, you might be dealing with the wp-config file which is a core WordPress file. You wouldn’t want so as to add to your problem by messing up a core file. Make a backup. If points go south, chances are you’ll merely restore the backup and start one other time.


1. Clear cache

Quite usually we now have found that WordPress errors are nothing nonetheless a brief lived glitch.

So, it’s attainable that the error may need been mechanically resolved, nonetheless you’re nonetheless seeing it because of your browser or WordPress is displaying a cached mannequin of your web page. Therefore, clear your browser and web page cache. And then, refresh the online web page.

We cowl the best way to clear your browser cache intimately throughout the following info. When it involves clearing your web page cache, the exact place the place you’ll be able to do which will depend on the caching plugin that you just simply’re using. Read further about this proper right here.

2. Fixing {{hardware}} & connectivity factors

Sometimes, the reply to a seemingly sophisticated topic is as simple as restarting your PC and router to restore it. Try that.

3. Check your error log

You can profit from the error logs to slender down the issue. All you wish to do is enable logging by together with this code to your wp-config.php file:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

A file generally known as debug.log will appear in your wp-content itemizing. Open it, and it should let you realize what’s inflicting the 502 Bad Gateway error.


4. Fixing server factors

Check whether or not or not your web internet hosting servers are down by using actually one in every of these devices: Down or Not, or Is It Down Right Now, or Down For Everyone or Just Me.

The server may need been taken offline for repairs features. In that case, you have to have obtained an e mail informing you about when the server shall be up as soon as extra.

Even in case your web internet hosting servers are up, talk to your web internet hosting provider. Find out whether or not or not it’s a server topic after which restore it.

5. Fixing poorly coded plugins and themes

The actuality is, chances are you’ll’t restore poorly coded plugins and themes because you didn’t assemble them. What you’ll be able to do is disable them. But how are you conscious which ones to disable?

Disable all the plugins and themes one after the opposite. And confirm your web page concurrently.

When you see that the error is gone, you’d know which plugin or theme induced it.


We strongly counsel that you just simply carry out this prepare on a staging web site to cease damaging your keep web page further.

6. Fixing browser topic

Open your web page on fully completely different browsers. If the error persists then adjust to the instructions underneath.

There are three frequent browser factors that WordPress prospects typically face. Those are corrupt extensions like ad-blockers, outdated browsers, and corrupt cache.

Update your browser if there’s a newer mannequin on the market. Also, try disabling ad-blockers and completely different extensions, one after the opposite. Keep checking your web page concurrently.

7. Fixing CDN server topic

To uncover out in case your CDN server is down, chances are you’ll confirm your CDNs standing net web page, like Cloudflare System Status.

Alternatively, try these devices: CDNPlanet and Downdetector.


Even if the CDN is up, it would nonetheless be a CDN topic. Try disabling the CDN. If the error vanishes, then communicate to the assistance group, asking them to restore the issue on their end.

8. Fixing DNS topic

Migrated to a model new web internet hosting provider or space registrar not too way back? Then wait as much as 24 hours for the DNS topic to be resolved mechanically. And when you find yourself at it, flush your DNS cache.

9. Fixing PHP timeout factors

You may think that rising the PHP timeout prohibit will resolve the issue. But web internet hosting limits are normally not the difficulty proper right here. The plugin or theme that requires further belongings to course of its PHP code is the first offender.

The PHP prohibit exists to cease abuse of your belongings. Hence take away plugins and themes that threaten to exhaust your belongings.

If the “502 unhealthy gateway” WordPress error nonetheless persists

On unusual occasions, when not one of many choices works, you wish to hire expert help. Take a check out our info on the best way to hire a WordPress developer.


Fixing some web page errors could be annoying and time-consuming. This is why we think about that every WordPress web page should take daily backups so that everytime you run into an error, chances are you’ll merely restore your web site once more to common.


This, in reality, is simply not a eternal reply, nonetheless it does present assist to carry your web page up and working, which allows you to look at the difficulty at a further helpful time.

Do you’ve got questions in regards to the “502 unhealthy gateway” WordPress error? Let us know throughout the comment half underneath!

Free info

5 Essential Tips to Speed Up Your WordPress Site

Reduce your loading time by even 50-80%
just by following straightforward concepts.