Connect with us


How to Fix 502 Bad Gateway Error in WordPress



502 bad gateway error is one of the most common error people encountered while working with WordPress. People usually get confused while working and getting this error.

But today we have a solution for you. In this post, we will see how to work with 502 bad gateway error and get the resolved easily.

What does 502 bad gateway error mean?

First, let’s understand what does 502 bad gateway error means when you get such issue. Usually, the WordPress setup is installed on multiple servers with the following config-

  • DB server also runs on the same WP server
  • Application server where all your files and login rely on
  • Gateway servers where software Nginx is installed. For example, you have a gateway server installed on 000WebHost and there Ngnix is installed.
  • Web server that serves your website files

Now when you open your WP site, the request goes to different servers and so, if any of these are not responding, you may get 502 bad gateway error.


Although it is not always necessary that you’ll always get the same 502 bad gateway error, but it has other variants also. Which means there are many other messages you will receive for errors, but all are one and the same. Here are the other variants of the 502 error-

  • 502 Bad Gateway
  • HTTP Error 502 Bad Gateway
  • 502 Service Temporarily Overloaded
  • Error 502
  • 502 Proxy Error
  • HTTP 502
  • 502 Bad Gateway NGINX
  • 502 Server Error
  • 502. That’s an error

No matter what error you’re getting out of above, the solution will be same as we are going to see below. Also, it is not true that only WordPress sites receive such errors. Many another top website also gets this error due to the above issues.

Google's custom 502 bad gateway error page

twitter's custom 502 bad gateway error

So, if you are thinking why the website shows such error, here are some details and the root cause of it.

Root Cause Behind 502 Bad Gateway Error

Here are some of the main reasons behind this error. The reason can be due to your hosting issue or some configuration issue as well.

  • One/all server cannot be reached or accessed
  • Server is overloaded with the request
  • Error-prone theme or plugin with WP
  • Browser cache
  • Network issue
  • Your CDN is not working properly
  • Domain is having DNS issue

Now as you know the error type and reasons behind it, let’s see how to resolve 502 gateway error in minutes.

Fix the 502 Bad Gateway Issue

We’ll discuss many methods using which you can resolve this issue. Let’s discuss that one by one here-

#1 Reload your website

Don’t just get panic when you get that issue. Because sometimes it can be simply a timing issue due to bandwidth issue. Your server might have overloaded and after reloading your server might have some bandwidth.

So, just by refreshing the website your issue can be resolved. If still, you’re getting the issue, check that site in other browser and if the issue is just for you, check your connection.

#2 Clear Browser Cache

This is for those where the issue is just for you and the site is working fine for others. In such cases, just clear your browser cache or try the site in the different browser and you’ll find issue disappear.

The reason behind this is, usually browser store the files and temporary cache for any website you visit and so, it keeps on showing you the outdated version.

#3 Restart Your Networking Equipment

If after reloading the site and clearing your cache haven’t helped you, it’s time to restart your router or any other network interface you’re using.

To do this, all you have to do it, either switch of the button in your router or just unplug and plug the power button. Make sure you give some time between the off and on the interval.

#4 Disable CDN

Sometimes the issue can be due to your CDN also. CDN is used to fasten the site but it may create the issue as well and so make sure to disable it and then try. If it resolves your issue, work on your CDN else move ahead.

502 bad gateway error caused by CloudFlare CDN

#5 Clear Local DNS Cache

You can clear your system’s DNS cache to make sure there is no issue from your end. Try the below commands-

Window Users: ipconfig /flushdns

Mac Users: dscacheutil -flushcache

#6 Check WP Theme & Plugins

As said above, the issue can be due to your WP themes and plugins also and, so you should check those. If you are unable to locate any, make sure to uninstall plugins installed recently one by one and check where is the issue. You can use FileZilla for such purpose as WP admin won’t work for you.

#7 Check your server

The last you can do is, check your server if it is online or not. If not, restart your server to make it work perfectly. If it is a physical server, you can request your hosting provider to do so. You can also check the services and jobs if you are using dedicated servers. Make sure you are using a good hosting like 000WebHost to ensure you are getting the proper solution.

Hello, I am Abhishek Yadav, I am an Internet Marketer and a Blogger. along with blogging I also have some Programming and content marketing skills. Connect with me on Twitter @Abhinemm to know more about me :)

Click to comment

Leave a Reply

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