Home » WordPress Tutorials » Administration » How to Fix Error 502 Bad Gateway in WordPress

How to Fix Error 502 Bad Gateway in WordPress

502 Bad Gateway is quite a common error message in WordPress and although it looks like something very serious and technically demanding to fix, there are some quick steps you can undertake to deal with the issue.

Just like Error 500 and 501 Not Implemented, Bad Gateway can be fixed with a few simple approaches.

 

How to Fix Error 502 Bad Gateway in WordPress

Before we jump into the various fixes, it is first important to note that Error 502 is an HTTP response code with a starting number of 5xx, which indicates that there is a problem with the server side in the communication between browsers and web servers.

More precisely, Bad Gateway message indicates that the server received an invalid response from another server and therefore can’t present the required information.

Luckily, there are a few things you can do to try and fix the problem:

 

Method 1: Reload the Webpage

This is by far the fastest and easiest method to try to deal with Error 502 – simply refresh your webpage and see whether the problem is solved.

Sometimes, there can be a momentary issue in the communication between servers and browsers.

If the refresh allows you to see the requested page’s content, then you have managed to deal with Error 501.

If this isn’t the case and you still see the message, proceed with the next method.

 

Method 2: Try Using a Different Web Browser

Sometimes, your preferred Internet browser can disrupt the exchange of data and display the Bad Gateway message. This is one of the few exceptions in which the 502 error message is caused by the client side.

To find out whether this is indeed the case, try using a different web browser than your default one.

If this helps, then there’s an issue with your default browser – see whether it is up to date, and whether are there any settings that you should change in order to ensure optimal performance.

 

Method 3: Clear Browser Cache

Usually, too many cached files can cause problems to your Internet browser. This is why it is important to clear the cache occasionally, and should you stumble upon an HTTP Error just like the 502 Bad Gateway one, try cleaning the cache and reopening the page.

In another article, we share how to do so, and what is cache in WordPress. If you are new to the topic, then have a look at both posts, as they are informative and simple to read.

 

Method 4: Flush DNS Cache

DNS cache is a term that describes the stored information about your Internet activity on your OS or web browser. It helps you retrieve information from the Internet faster.

However, too many DNS cache files can cause connectivity issues and force web browsers to display various types of error messages such as 502 Bad Gateway.

If this is indeed the case, you should clean these files. Here’s how you do that.

Windows OS: Open your command prompt and enter ipconfig /flushdns .

When the process is finished, the command prompt interface will display a success message:

WordPress Error 502 flush DNS cache

 

macOS: Enter the following in the terminal: dscacheutil-flushcache .

Note: There isn’t any success message on macOS.

 

Method 5: Check WordPress Plugins and Themes

Sometimes badly coded plugins and themes can cause a series of issues and errors. If you have noticed that the Error 502 message appears right after you’ve installed some new plugins or themes on your WordPress site, chances are that they are the root of the problem.

To see whether some plugin is creating the issue, then enter your WordPress admin panel and from there go to Plugins->Installed Plugins:

WordPress Installed Plugins

 

Then, bulk select all of them, and from the Bulk actions menu select Deactivate and hit Apply:

WordPress list of Installed Plugins

List of WordPress Installed Plugins

Now, try to open your site and see whether the 502 Error message is still present. If it isn’t, then the problem lies in some of the deactivated plugins. To see which one exactly, do the following:

  1. Go to Plugins->Installed Plugins and activate the first plugin in the list and keep the rest deactivated. Then, open your website.
  2. If you don’t see the error message, then go back to the list of installed plugins, deactivate the first in the list, activate the second one, and keep all the rest deactivated and again open your WordPress website.
  3. Repeat this process until you activate a plugin that forces the 502 error message.
  4. Once you locate it, deactivate it and try to search for an alternative one. Also, you can reach out to developers for further help.

 

If you believe that a newly installed WordPress theme is the issue, then do the following:

Via your WordPress admin dashboard go to Appearance->Themes:

WordPress Installed Themes

 

Once there, activate some of the default themes, for example, Twenty Twenty-One, and try to open your website:

List of WordPress Themes

 

If you can open your website, then the problem lies within the previously active theme. You should replace it with another one, or contact developers for further assistance.

Method 6: Contact Your Hosting Provider’s Customer Support Team

If none of the above helps you, then it is time to reach out to the customer support team of your hosting provider. Once you do, describe your problem and explain what you tried to do in order to fix the problem, so they can give you thorough comprehensive feedback and a solution.

In fact, when searching for a hosting provider, it is very important to choose a brand with a qualified customer support team, as you can quickly ask them for a quick solution to any of your technical issues.

One such provider is ZETTAHOST – along with an extensive list of web hosting services, we also work with a qualified team of experts that are available 24/7, so you can contact us at any given time.

 

Conclusion

Error 502 Bad Gateway is one of the most popular Server side response codes and can be very annoying at times. Luckily, you can fix it with a few quick solutions, so you get your WordPress website up and running.

Related:

Was this article useful?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Newest Articles:

How to Format Text in WordPress

When you create a post in WordPress, typing down the words is only a part of the job. Once written, you should format the text – separate paragraphs, include subheadings where needed, bold words and phrases, underline others, and include numbering and bullet points at...

How to Fix Error 505 Version Not Supported in WordPress

Error 505 Version Not supported might appear in various situations when working on your WordPress website. This kind of error can be very confusing and can show when least expected. However, the good news is that there are various fixes you can apply right away to get...

How to Fix Error 504 Gateway Timeout in WordPress

Error 504 Gateway Timeout in WordPress can really be annoying for you and your website visitors. The good news is that as with any other 5xx status code errors such as HTTP Error 500, Error 501 Not Implemented, and Error 503 Service Unavailable, the Gateway Timeout...

How to fix Error 501 Not Implemented in WordPress

When working on your WordPress website, you will eventually stumble upon various error codes such as 404 Not Found, Service Unavailable, and Error 500. Your web browser displays such error messages when there’s some issue between the web server and an Internet...

How to Add a Contact Form in WordPress

When you first start to use WordPress, it all may look a bit confusing and difficult. This is why we created a comprehensive WordPress guide that explains everything you need to know about the platform and how to build your first website step by step. In this article,...

Ready to Create Your Website?