Would you like to fix the 502 Bad Gateway error on your website?

This error is quite annoying because it can be caused by many different things. This means that it may take some time to troubleshoot the 502 Bad Gateway error.

In this tutorial, we are going to show you how to easily fix the 502 Bad Gateway error on WordPress.

By the way, we hope you have already created a website or WordPress blog. Otherwise, see this detailed guide or go further with : How to create an Autoblog with WordPress.

How to fix Wordpress 502 bad gateway error

What is a 502 Bad Gateway error?

Bad Gateway Error 502 is triggered when your WordPress hosting server gets an invalid response for the requested page.

The 502 Bad Gateway error is one of the common WordPress errors that you may encounter on your website. Whether you are about create a website bycompany, a Online Store or a blog on WordPress it can be caused by a number of reasons and depending on the server. This error message may also differ slightly.

gateway error 502.png

When you visit a website, your browser sends a request to the server. The server then finds the page and returns it to your browser with the status code.

Normally you would not see this status code. However, if there is an error, the status code is displayed with an error message. Examples of such errors are among others 404 not found , 503 service unavailable , 403 forbidden error , and more.

See also this article and discover How to fix an 504 error on your WordPress website

The most common reason for a 502 Bad Gateway error is when your request is taking too long for the server to respond. This delay may be a temporary issue caused by heavy traffic. It could also be a problem caused by a theme or a WordPress Plugin poorly coded. And finally, it can also happen due to misconfiguration of the server.

That being said, let's take a look at how to fix the 502 Bad Gateway error easily.

Fix 502 Bad Gateway error

How to fix error 502 bad gateway wordpress 1

This error is usually caused when your server is unable to find the cause of the invalid response. This means that we will try different troubleshooting steps until we find the problem.

Step 1: Reload your website

Sometimes your server may take longer to respond due to increased traffic or low server resources. In this case, the problem may disappear automatically within a few minutes. You should try to reload the web page you are visiting to see if this was the cause.

Discover also our 5 methods to speed up the loading of your WordPress blog 

If this solved your problem, then you don't need to go any further. However, if you see this error frequently, you should read on as there may be something else to fix.

2 step: Clear the browser cache

Your browser may show you the error page of the cache. Even after the issue is resolved, you would see the 502 error because the Sailor Load your website from the cache.

To resolve this issue, users with Windows / Linux operating systems can press the Ctrl + F5 keys and Mac OS users can press the buttons CMD + Shift + R of their keyboards to refresh the page. You can also manually delete the cache from your browser settings.

erase site data cookie and cache.png

Once you've cleared your WordPress cache, try loading the website again.

You can use a different browser to troubleshoot if the issue occurs due to the browser cache. If you see the error on all browsers, keep reading.

You can also use one of WordPress plugins premium below to quickly resolve this issue.

3 Step: Disable CDN or Firewall

If you are using a CDN service or website firewall on your website, their servers may be working. To verify this, you will need to temporarily deactivate your CDN.

Here without doubts 4 new CDNs you probably do not know

Once disabled, it will remove the extra layer created between your browser and the server. Your website will now fully load from your server and if the problem was caused by the CDN / firewall service, it will be resolved.

You can then contact your CDN service provider for assistance. Once the issue is resolved, you can go ahead and re-enable the CDN.

4 Step: Update WordPress Themes and Plugins

If the error persists, the next step is to check your Thème or your plugins.

First, you will need to disable all WordPress plugins through FTP. After that, visit your website to see if the error has resolved.

If so, then one of your plugins was causing the problem. Now you need to activate all plugins one by one until you can reproduce the error. This will help you locate the plugin responsible for the error.

You can find a alternative plugin or contact the plugin author for support.

If disabling plugins did not resolve your issue, then you will want to check your WordPress theme. You should change WordPress theme via phpMyAdmin.

For novices, discover How to properly uninstall a WordPress plugin

After changing your theme to the default WordPress theme, visit your website to see if it works. If you still see the error, keep reading.

Step 5: Check your server

If all of the above troubleshooting steps fail, it is likely to be a problem with your server.

You should contact your hosting provider's support team and let them know about the problem. You can also mention any troubleshooting steps you have taken.

If you are looking for a particular type of server, discover our comparison on the Dedicated Server, VPS, Shared or Cloud? What is the best WordPress hosting solution

All good web hosting company will be able to quickly solve the problem if it is caused by a misconfiguration of the server.

Recommended Resources

Also find out about other errors and how to fix them by reading these articles.

Conclusion

That's all. We hope this article has helped you learn how to fix 502 Bad Gateway error on WordPress. If you have any questions or suggestions in this area, ask us in our section Comments.

But if you want to find a premium WordPress theme optimize for creating any website, the Avada WordPress theme is one of the options we offer.