Can you see a “502 Bad Gateway” error on your WordPress website? That is annoying, but luckily it is usually quite easy to solve. In this article, I show you what the causes of this error are and how you solve them.
What does the “502 Bad Gateway” error mean?
The 502 error is very irritating because your website (for you) is completely unreachable. Moreover, this error message can have many different causes. It may, therefore, take a while before you have solved this error.
You get a 502 error when an invalid “response” is given from your WordPress hosting. However, this does not automatically mean that the error lies with your hosting party.
One of the most common reasons for a 502 error is when it takes too long for the server to respond. In this case, the error message can be temporary, for example, because you receive as much “traffic”. It may also be because a plugin or theme on your website is not well organized and therefore sends too many “requests”, causing the server to take a very long time to respond. It is also possible that your hosting party has not configured your server correctly.
“502 Bad Gateway” solutions
I will now show you a number of ways you can try to solve a 502 error.
1: Delete your cache
It is possible that your 502 error has been resolved long ago, but that your browser is showing the error because it is in your “browser cache”. You can check in several ways whether this is the case, for example by visiting your website in a private window (or incognito window in Chrome). If you do not see the error in a private window, then it probably lies here.
To solve it, on a Mac you can use the key combination Command + Shift + R to do a “hard” refresh, or on Windows computers Control + F5. If this does not work, try to be sure to manually remove the cache from your browser. Especially with browsers such as Google Chrome, the cache can be pretty “stubborn”!
If this does not solve your 502 error, read on.
2: Turn off your firewall and/or CDN
If you use a CDN or a firewall (such as Cloudflare ), then something may go wrong here. Therefore, temporarily switch off your firewall or CDN to see if that solves the problem. After turning off your CDN and firewall, you may have to remove your cache to make sure that this is the solution. If this has solved your problem, activate your CDN and/or firewall to see if the problem occurs again. If so, please contact the party where you have your CDN and/or firewall.
3: Update themes and plugins
Have the above tips not helped? Check if your themes and plugins are up-to-date. Log into your server with FTP and deactivate your plugins one by one. Every time you have deactivated a plugin, you can check if your website is working again before you deactivate the next plugin. This way you can find out which plugin may cause problems.
Was it up to a certain plugin? Then log in to your WordPress admin environment and check whether an update is available for that plugin. If so, install the update, activate the plugin and then check whether the problem is corrected.
Although this is not very common, it can also be your WordPress theme. It is best to change the name of your theme folder via FTP so that WordPress “falls back” on the standard theme. Make sure that the “default” WordPress theme is also in the “themes” -folder. At the moment, Twenty Seventeen is the standard WordPress theme.
4: Contact your Hosting Company
If your error is still not resolved, then there is probably something wrong with your hosting server. Then contact your hosting party and mention that you have already gone through the above steps. A good hosting Company has the problem in no time for you obsolete.