This article was originally published on this site

No one wants to see a 502 Bad Gateway Error appear on their WordPress website. When they pop up, they have the potential to annoy guests. Even worse, if your website is down for hours at a time, you may begin to slip lower in search engine rankings.

Thankfully, knowing what the 502 Bad Gateway Error means – and how to fix it – can get your WordPress site back up and running smoothly. Of course, it may take a little troubleshooting to determine the cause.

In this article, we’ll go over what a 502 Bad Gateway Error is, and what could be causing it. Then, we’ll detail three solutions to fix the problem and get users enjoying your content again. Let’s get started!

An introduction to the 502 Bad Gateway Error

Before we dive into the particulars of a 502 error, it’s helpful to know what a ‘gateway’ is. Essentially, this term refers to a device that enables networks to communicate with one another.

In some instances, your website’s server may act as a gateway. The 502 response is its way of telling you that it received an invalid response from another server it was attempting to communicate with.

Ultimately, a 502 Bad Gateway Error is a server-level issue. This means it’s not a WordPress-specific problem, nor is it directly related to your website. Therefore, it may be difficult to fix on your own.

Possible causes of the 502 Bad Gateway Error

The key to determining whether a 502 Bad Gateway response is something you can troubleshoot yourself is to figure out specifically what’s causing it. There are several possibilities, including:

  • Overloaded servers
  • Browser errors
  • Problems with home networking equipment (such as your router)
  • Plugin incompatibilities
  • Corrupted cached files or cookies
  • Outdated software

Some of these problems are temporary issues that may resolve on their own or with some simple intervention. Others, such as overloaded servers, may be out of your hands.

How to fix the 502 Bad Gateway Error in WordPress (3 simple methods)

Before contacting your hosting provider for help, it’s best to try at least a few methods for resolving the 502 Bad Gateway response on your own. Here are three ways you may be able to fix it yourself.

1. Refresh the page and clear your browsing data

As we mentioned earlier, 502 responses are sometimes temporary. Your first order of business should be to refresh your page to see if the problem persists.

In the event it does, the next simplest fix is to clear your browsing data. This process will vary slightly depending on which browser you prefer. In Google Chrome, access your settings by clicking on the three-dot icon in the top right corner of the window:

Accessing the Chrome browser settings.

Then, click on Privacy and Security:

Accessing the Chrome Privacy and Security settings.

The first option should be Clear Browsing Data, which you’ll want to click:

Selecting the 'Clear browsing data' option in Chrome.

This will open a popup window. Make sure the checkboxes next to Cookies and other site data and Cached images and files are checked, then click on the Clear data button:

Clearing the Chrome browser cache and cookies.

Close your settings and refresh the page returning the 502 Bad Gateway Error. If corrupted cached files or cookies were causing the issue, it should now be gone.

2. Test for problematic plugins

Sometimes bad code from a plugin can cause your server to cancel a request. Caching plugins are a popular culprit, but it’s wise to do a little detective work to make sure you weed out the root of the problem.

If you have access to the back end of your site, simply deactivate your plugins one by one, and check the page experiencing the 502 Bad Gateway response between each. When the error disappears, you’ll know the most recently deactivated plugin was the one causing it.

If you can’t reach your WordPress dashboard, don’t fret. You can accomplish the same outcome using File Transfer Protocol (FTP) and an FTP client such as FileZilla. Retrieve the necessary credentials from your hosting account, then connect to your server and navigate to wp-content > plugins:

Accessing the WordPress plugins directory via FTP.

Here you’ll see a folder for each plugin installed on your site. Rename them one-by-one, which will deactivate them:

Renaming plugin folders via FTP.

Again, check the page returning the 502 response between each deactivation. When it disappears, you’ve found the problematic plugin. From here, you’ll need to remove this plugin from your site. Then, you can either replace it with an alternative, contact the developer and ask for a fix, or simply prune the functionality from your website altogether.

3. Increase your PHP timeout limit

Every server has a PHP timeout limit that determines how long a process can run. This prevents users from abusing server resources, especially on shared servers.

However, if you’re attempting to run a long process in WordPress such as importing large files, you may unintentionally exceed this limit. Fortunately, you can increase it on your own.

First, you’ll need to access your .htaccess file. You can do so using FTP and FileZilla:

Editing .htaccess via FTP.

Open it, add the following line of code at the end, then save your changes:

php_value max_execution_time 300

If the 502 Bad Gateway Error persists, you can change 300 to a higher number – go in increments of 100 to be safe. Note that some hosts have a limit how high you can set your PHP timeout limit. If this is the case for you, you’ll likely have to call and as your provider to increase your timeout allotment, or upgrade your hosting plan.

What to do if you can’t fix the 502 Bad Gateway Error

If none of the above solutions have worked for you, there’s probably a server-level issue causing your 502 Bad Gateway response. It may be an outage or some other issue that’s beyond your control.

As such, contacting your host should provide some answers regarding what’s happening to your server. The support team can then get to work fixing the issue, which should resolve the error on your site.

In the event that the issue arises again, you’ll want to consider whether your hosting is up to scratch and if a change is necessary. Of course, this is a personal decision based on your needs, frequency of errors, and plenty of other factors.


Any error that prevents users from accessing your site poses a serious threat. Downtime results in missed conversion opportunities and could even have negative effects on your search engine visibility.

Fortunately, there are plenty of ways to go about troubleshooting a 502 Bad Gateway Error, other than contacting your host:

  1. Refresh the page and clear your browsing data.
  2. Test for problematic plugins.
  3. Increase your PHP timeout limit.

Do you have any questions about fixing a 502 Bad Gateway Error in WordPress? Let us know in the comments section below!

Featured Image Credit: Pexels.