I know it sucks, but here you are, so let me help you fix the 502 bad gateway error in your WordPress website.

Errors are annoying not just to enthusiast website owners, but to even the experienced technical individuals.

It leads to bad user experience and costs a lot in terms of time and potential revenue lost due to server downtime, yet the reality is that you can never avoid system glitches and thus, errors entirely.

The 502 bad gateway error is one common error not only to your website or WordPress websites at that, but even Google also experiences it every once in a blue moon. Hope that in a way comforts you.

What Causes the 502 Bad Gateway Error?

A 502 bad gateway error is an error that a browser displays when the server of a website you are accessing fails to respond to a request.

Since this is something that happens to any server out there, and since users visit websites from all sorts of browsers, it is possible to see a different variation for the error, here are typical errors that can be thrown;

  • 502 Bad Gateway
  • Error 502
  • HTTP 502
  • That’s an error
  • 502 Proxy Error
  • 502 Service Temporarily Overloaded
  • A blank white screen
  • Temporary Error (502)
  • HTTP Error 502 – Bad Gateway
  • 502 Server Error: The server encountered a temporary error and could not complete your request
  • Bad Gateway: The proxy server received an invalid response from an upstream server

Whatever the error one sees, the browser is accessing the upstream server or the proxy server, but somehow their requests are not being fulfilled.

Now that you know what it is, it will be easier to fix it. We shall explore a number of methods that should help you get your website running.

Different methods to fix the 502 Bad Gateway Error in WordPress

1. Reload/refresh the website

starting with the most natural thing you can do, anything can happen in the transmission of data between your browser and the server, a refresh may fix the error.

2. Check your website on another browser or different location

if a refresh does not work, switch browsers, and see if you get the same error. You can also try accessing the website from a different location, the easiest way you can do that is using a proxy service – there are many of them online for free.

If your website loads fine on another browser or location, then the issue is with your browser, step three should help with that. Else, it is time to get techy.

3. Clear your browser cache/cookies/history

If a website works fine in other places then chance is that your browser is serving you an older version of the website it saved, simply reset your cache, and you should be fine.

If these basic, steps didn’t fix the 502 bad gateway error, then it is time to dig into other underlying causes.

4. Investigate the server and the DNS issues

How do you know if it is the server? Again, start with a simple ping of the server  – several online tools help you with that, but, I will use an old school trick of pinging from your terminal.

Ping your website from the terminal

A ping of wpvivid.com shows that there is a 0% loss if yours shows the same results, then we know the server is appropriately functioning, move on and check your WordPress plugins and WordPress themes – if there is a loss, then go to step 6 and contact your host if you are using a managed hosting service.

If you are using a CDN service like that of Cloudflare, the IP address displayed will be that of Cloudflare, so you will need to know the IP address your host provided you when you created the account.

Still, under checking your server, you will need to check if your databases are working, typically you will get a no database connection error on WordPress, but, the 502 error can also be caused by that.

If you host multiple websites on the same server, you can quickly also rule out the server issue by visiting the other sites if they work fine then the problem is isolated to your website. In that case, check your plugins and themes for potential problems.

If, all your website is experiencing the same issue, then contact support.

5. Check your plugins and themes

A malfunctioning plugin or theme can be a likely cause of the 502 error. If you have tried all the above steps and they point to something to do with your WordPress files, then access the files of your website, either through FTP client or logging into the control panel.

For cPanel, go to wp-content/themes or wp-content/plugins for plugins.

Check your plugins and themes with cPanel

Inside the plugins directory, for instance, right click and then rename each plugin.

Rename each plugin with cpanel

If you have many plugins, you may find this tedious; what you can do is select all the plugins, compress them to one file and then delete all the plugins.

Now check your website, if the error is gone, then we can conclude it is a troublesome plugin causing the 502 bad gateway error.

Enable one plugin at a time as you reload your website until you land on the culprit. Unfortunately, there is no shortcut to this.

This applies to the themes too.

Warning: make sure you have saved a copy of your files somewhere before you do things that you will regret.

6. Contact Support

Since a 502 bad gateway error is likely to be an issue with the server, then this can quickly be resolved by contacting your host’s support center.

They are best positioned to fix any issues related to a misbehaving server or software running on it.

Be sure to advise them on all you have done trying to troubleshoot the issue since they will most likely ask you to do those same tasks first.


For most website owners, a 502 bad gateway error is easily fixed by oneself, just follow the steps above, and you will do fine.

In the worst case scenarios, your host’s tech team can help you restore your server or move you to a different server.

When you think of worst-case scenarios, think backup – if you have been reading our articles, I may sound like a broken pipe on this, but, trust me everyone will need a back at one point in time, so save yourself the trouble and implement one today, actually, now.

We have made it very easy with our WPvivid backup plugin – it does everything for you on autopilot saving your files on the cloud with providers like Google Drive.

You may also want to see our step by step guide about how to fix the 500 internal server error in WordPress.