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 Copy a Page with WordPress Gutenberg Editor

Looking for ways to copy your WordPress web pages? The Gutenberg block editor got you covered. In this article, you will read about 3 different methods you can instantly apply when crafting your WordPress website.   How to Copy a Page with WordPress Gutenberg...

How to Add Tabs to Your WordPress Site with Gutenberg

Tabs are quite useful in numerous situations and can be a fresh addition to your WordPress websites. Massively used to showcase content categories, news, and various other types of posts in a very structured manner, tabs contribute to making your site content more...

How to Create Tables in WordPress Using Gutenberg Editor

Creating a table in WordPress with the Gutenberg Block Editor is a straightforward task. Should you need to add one or several tables to your pages, the following paragraphs explain how to do so.   How to Create Tables in WordPress using Gutenberg Editor  ...

5 Best WordPress Slider Plugins for Gutenberg

When crafting your WordPress website, it is not only important to publish informative and well-structured content, but it is also crucial to make your web pages as aesthetically appealing as possible. An effective way of making your site more beautiful is by inserting...

How to Use the Navigation Block in Gutenberg

With the Gutenberg Navigation block, you can add various types of navigation on any page or within any blog post on your website. Similar to the classic WordPress menu, the Navigation block can be modified in numerous ways and become a handy tool in many situations....

Ready to Create Your Website?