Your Dedicated Partner for All Things WordPress

How to Fix 502 Bad Gateway Error in WordPress

Table of Contents

Error 502 is a common error that you might come across in WordPress. For a beginner, you might think it is a nightmare to solve it. However, it is not so. The error is easier to solve and you can solve it in no time. We will be seeing the method to fix the 502 bad gateway error in WordPress. We will not just see one method but we will see many methods to do it. So, one of these will surely work for you.

Overview of 502 Bad Gateway Error in WordPress

How to Fix 502 Error in WordPress

We will first begin with the overview of error 502. The error can be displayed in various possible ways.

In some browsers, you will just see the blank screen and nothing else. So, if you are seeing a white blank page after opening the WordPress website, there is a good chance that you are facing error 502. So, we will see how to fix it.

It might also be displayed as 502 – Web server received in an invalid response while acting as a gateway or proxy server.

The error is in red and you surely might have come across this.

As the error says, it is when the server sent an invalid response. In most cases, it is because the request was not known.

You can fix it in no time.

Before we get into the fixing method, we will see how this error is displayed.

  • “502 Bad Gateway”
  • “Error 502”
  • “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
  • “502 Service Temporarily Overloaded”
  • “HTTP Error 502 – Bad Gateway”
  • “502 Proxy Error”
  • “HTTP 502”
  • Temporary Error (502)
  • That’s an error
  • 502 bad gateway Cloudflare
  • A blank white screen

If you see any of the errors from the above, the solution is the same. We will now head over to the solution.

Fix 502 Bad Gateway Error in WordPress

We will now see how you can fix the 502 bad gateway error in WordPress.

Firstly, you can try out some of the most basic things to see if the website is working or not.

This includes waiting for some time and refreshing the page.

Many times when the update process is going on, you will see the error and it won’t work. So, the best way would be to wait for a couple of seconds and retry. If it still doesn’t work, you can surely continue to the next steps.

Some of the steps given below will also include many changes in your website or the file manager. It is recommended that you take the proper backup of the website before you start making the changes. This will make sure that the website is safe.

Even if something goes wrong, you can restore the previous version of the website with just a few clicks. So, whenever you are making the changes in the files, have a proper backup of your website.

Clear the Cache of your Browser

Well, sometimes the problem isn’t on the server but on your computer. You can try fixing the browser first.

How to fix it? Well, you just need to clear the cache memory and try again.

If you don’t want to clear it, you can try opening the website in incognito mode. If the error is gone then the issue is with your browser and not with the server. So, you can easily fix it.

Further, make sure you check the website in incognito mode only. This will make sure that the website is error-free or if it has an error.

Incognito mode will load the website without any cache memory and that’s the reason why you should do it every time after applying one of the methods.

Talking about the cache memory, it is not necessary that the browser’s cache memory might be giving them problems. Sometimes, there are good chances that the server’s cache memory is the real culprit. So, we will also fix the issue with the server cache memory and try loading the website again.

It’s not as easy as opening incognito mode. So, we will have to mess around with the plugins to do it.

Server Cache

As mentioned, the server cache might also be the issue in some cases. So, we will try to clear the server cache.

In WordPress, there are plugins to handle the cache. If you have activated one of the plugins, then the plugin might be the issue.

So, you can first try to clear the cache memory from the plugin. Depending on which plugin you use, you can do this easily.

First, you can try configuring the plugin in the right way. If that doesn’t work, you can simply deactivate that plugin. This usually works. If you deactivate the plugin, it will no longer save the cache. Hence, you can see the website.

If you don’t have access to the main WordPress dashboard, you can head over to the file manager and from there, you can rename the plugin. Find the cache plugin in wp-content/plugins and then deactivate that plugin.

That’s pretty much it. After doing that, the plugin will be deactivated and your website will work fine.

You can first try to clear the cache before you deactivate it. If you clear the cache memory, it will remove all the server cache and your website might work again. However, if this doesn’t work, you can deactivate it.

Deactivate all the Plugins

If the above method doesn’t work, you can try deactivating all the plugins. This usually works.

You can just rename the entire plugin’s folder. Just open your file manager and head over to wp-content and then you can rename the plugin folder inside it.

When you rename the folder, it will deactivate all the plugins. It won’t delete the plugin and most of the configurations will also remain the same. So, there is nothing to worry about.

Also, you still have your backup. So, in case something goes wrong, you can surely restore the backup and get the website up.

Once you delete all the plugins, you can try visiting the website. If the website works fine, you can activate all the plugins again.

If the website doesn’t load after activating the plugin, you can try troubleshooting the plugin.

Just activate some plugins and see if the issue occurs again. If not, you can activate some other plugins. This will give you a clear idea about which plugin is causing the error 502. Once you find the plugin, you can easily fix the 502 bad gateway error in WordPress.

With that being said, you can easily fix the issue. Make sure you activate all of them after deactivating them.

Further, if you found a plugin. You can try updating the plugin. In some cases, the outdated plugin might be giving the issue. Therefore, if you try to update it, the problem might be fixed. Also, if there is no update, you can try deleting the plugin and then reinstalling it again. Please note that it might remove the data too. So, choose wisely. Sometimes, the bad configuration might be the reason for the error.

DNS Configuration

If there is some problem with the DNS, you might see this error. So, we will now fix the issue with the DNS.

There can either be the browser’s DNS issue or it could be the domain’s DNS.

To see the browser’s DNS, you can open your CMD with admin access and type the following line.

ipconfig /flushdns

How to Fix 502 Error in WordPress

Hit the enter button and see if the website is opening again.

Other than this, if you have just changed the DNS of your domain name, you will have to wait for at least 48 hours. Sometimes, it may take up to 48 hours for DNS to propagate. Therefore, you can wait for at least 48 hours and see if the website is loading back to normal.

Ask the Server Provider

The last option will be to contact the hosting provider and ask them about the issue. You can also check the server logs.

However, if you can’t understand anything there, you can surely contact the hosting support. They will surely help you out. In most cases, they will solve the entire problem from their side. However, if they don’t solve it or they are unable to solve it, they will surely tell you what’s causing the issue.

Now that you know the reason for the error, you can solve it in no time. You can see which of the above steps applies to you and try that again.

Final Words

To conclude, this was all about how to fix a 502 bad gateway error in WordPress. It surely impacts SEO. Therefore, make sure you solve this error as soon as you can. If you are using CDN, you can try disabling the CDN and see if it is working properly or not. Don’t forget to take the backup of your website before trying any of these methods.

How to get started?

Learn more

WordPress Maintenance

Save 33% with our Annual pricing plan.

Get Started

Having Troubles With WordPress?

Claim Your Free WordPress Maintenance

In today’s fast-paced digital landscape, every website deserves the care and expertise of a professional maintenance team, ensuring optimal performance, enhanced security, and seamless user experiences, so you can focus on growing your business with peace of mind.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices