Fix Error 502 Bad Gateway In WordPress Website

502 Bad Gateway Error in WordPress

502 bad gateway is a response code from the server to a browser. 502 bad gateway error occurs when the web hosting server gets a wrong response for any requested webpage.
Let’s understand how it works.
When a user visits any website, your web browser sends a request to the server for the requested webpage. Your hosting server finds and sends the page to the browser along with a status code. Usually, you can not see the status code. But, when the server did not get the webpage or gets an invalid response, it comes with an error code or status code. Examples are, 502 bad gateway, 500 internal server error, 403 forbidden error, 404 page not found.

Different Names of Error 502 Bad Gateway

  1. Error 502
  2. 502 proxy error
  3. 502 server error
  4. HTTP error 502- Bad gateway
  5. HTTP 502
  6. 502 server error
  7. Temporary error 502

Steps To Fix 502 Bad Gateway Error

502 bad gateway is the most common WordPress Error. Perform the following ways to fix 502 errors on the website.

  1. Try Reloading your website
  2. Clear All browser cache or try a different browser
  3. Look for faulty themes or plugins
  4. Disable your CDN (Content delivery network) temporarily
  5. Restart your networking device
  6. Check for DNS issues (DNS stands for ” Domain name system)
  7. Contact your hosting service provider

Reload your Website 

When you face error 502 bad gateway on your website, try reloading your webpage. Sometimes, due to heavy traffic, webserver takes a longer time than usual to get the webpage. But, after reloading the 502 error persist, then, in this case, you have to deploy some other way to solve the problem.

Clear Your Browser Cache

It is an essential step to perform because sometimes, the issue gets fixed, but you still see the error page because your web browsers get the result from the cache.

To fix this issue on Windows computers, press CTRL+F5 for mac press CMD+Shift+F5 or remove cache directly from browsers setting.

To check, you can also use a different browser, and/if the problem occurs on all the browsers, then you need to perform different options.

Keep reading to resolve 502 error.

Check for Faulty WordPress Plugin and Theme

After following the above-stated steps, you are still facing the error. Then there can be a problem with your WordPress plugins and themes. How to do that? Let’s start with checking Plugins.

You have to deactivate all the plugins from Cpanel or hosting server. Use FTP for the deactivation of all the WordPress plugins.

Connect your WordPress hosting through FTP client software (FileZilla).

Look for folder wp-content your plugin folder located in wp-content directory,

Right-click on the Plugin folder and rename it “Plugin_Old” it disables all the plugins. After that, you’re ready to check your website to know whether the issue has sort or not?

If it fixed, it means one of your plugins is creating the problem,

Now you have to activate one by one all the plugins. Keep it doing until you find the faulty one.

If you find no problem with the plugin, then you’ve to move to check out the themes.

Deactivate your WordPress Theme

, go to your hosting server file management system.>Got to wp-content/themes. Here, you need to rename the themes folder. So change its old name. What you can do is add “old” along with the currently used theme. For example, if your WordPress installed theme name is ASTRA, you have to rename it to “ASTRAOLD.” Now you can refresh the page that depicts the error. This way, 502 bad gateway error removes.

Temporarily disable CDN

Content delivery networks, as well as firewalls, can also be the cause of error 502 bad gateway. In case if you are using CDN service from the third-party provider, then you can troubleshoot the problem quickly. Go ahead and disable your CDN. If the problem caused because of CDN, then it gets fixed automatically.

You need to contact your CDN Service provider to resolve the CDN issue; Once the Problem fixed at their end, you can easily enable it back.

Note: “CDN creates additional security layer between your server and browser.”

Restart your networking device

Sometimes there are no issues with plugins, themes, and cache. But the issue can be quickly sorted by merely restarting the networking device. Because in some cases, 502 bad gateway error happens due to issues with networking tools or equipment. The most influential part of networking devices that can create a problem is the router. The router gateway causes the error. What you ought to do for this? You can remove the cable which supplies power to your networking device. After that, wait for 50-60 seconds. Again plug in the device. In case you have a router as well as the modem, you need to firstly plug in the modem after that at least wait for a time of 1 minute. And then you are allowed to plug in the router. You’ve to wait for 2 more minutes. Now you’re all set to check whether an error has removed or not. Now restart your PC/laptop can the issue persist or not?

DNS issues

When you have shifted from your respective website to another IP address, it can impact your website domain name server. These changes take some time to propagate correctly. The only way of fixing this is to be calm and wait for at least 24-48 hours until these changes are showing its full effect.

Contact hosting server provider

If all the troubleshooting mentioned above steps failed, then it is likely an issue with your hosting server.

Then you are allowed to contact your hosting service provider team to resolve the issue of 502 bad gateway.

Final Thoughts 

In this tutorial, we have discussed how to fix error 502 bad gateway in wordPress. I hope this tutorial has helped you. If you have any doubt, ask me directly in the comment box.

If you like this article, please subscribe to our youtube channel like us on Facebook you can also find us on twitter and instagram.

Leave a Reply

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