Lỗi 502 khi filter trong woocommerce của googler năm 2024

If you’re a site owner, few things make your stomach drop like trying to load your website only to receive a cryptic error message. You’re probably familiar with the 404 Page Not Found error, but what about the 502 Bad Gateway issue?

Fortunately, the 502 error is usually easy to fix. Once you’ve found the source of the problem, resolving it is something most WordPress users can do on their own, without advanced technical knowledge.

In this article, we’ll cover the different causes of a 502 error. Then, we’ll show you how to isolate and resolve the issue.

What causes the “502 Bad Gateway” error in WordPress?

The 500 series error codes, also known as HTTP status codes, are used to diagnose communication errors between a web browser and website server. Essentially, when a browser tries to connect to a website, it contacts the website’s server to request access. If this request cannot be fulfilled, then a 500 series error is usually returned, explaining what went wrong.

Error 502 indicates a bad gateway. This is when a server attempts to access another server but is unable to complete the request.

Usually the error is not with the website itself, but the server being accessed. The website is simply behaving as a middleman, or “gateway,” but is unable to deliver the requested data.

If your WordPress site is being affected by a persistent 502 error, it may be a server error outside of your immediate control. This error can make your site inaccessible to visitors. It can also negatively impact your search rankings, as search engines may be unable to access your site.

While this is normally an issue with your host’s servers rather than your website, there are still some things you can do to fix the problem. In this next section, we’ll cover some possible solutions.

How to fix the “502 Bad Gateway” issue in WordPress

Before reaching out to your host to see if they can resolve the 502 Bad Gateway error, there are some troubleshooting steps you can take to rule out an issue on your end. If these actions help you fix the error, you might want to keep an eye out for repeat issues. If your site is frequently plagued by the 502 Bad Gateway error, you may want to consider upgrading your hosting services.

1. Refresh the page

As with most server issues, simply refreshing the page is always worth a try. If the error was very temporary or just a fluke, it might go away with a refresh.

A temporary blip or loss of service from an upstream server might resolve itself, allowing for the connection to complete on the next attempt. Sometimes a spike in traffic or loss of connection at the target server can also cause issues. As you’re troubleshooting, you may want to refresh every so often to see if the error persists.

If refreshing the page solves the problem, it’s safe to assume that the source of the cause was your host. These issues usually resolve themselves quickly.

2. Clear your cache and DNS

On rare occasions, a full cache on the client’s end can simulate server errors, as it’s unable to receive new data as requested. While this is unlikely to return a 502 Bad Gateway error, clearing the cache is a quick and easy fix that can help you rule out the issue.

Let’s look at how to clear the cache in Google Chrome. Most other browsers will follow a similar process.

First, click on the three-dot icon in the top right corner of the browser window and select Settings. Then, navigate to Security and Privacy on the left.

Lỗi 502 khi filter trong woocommerce của googler năm 2024

Here, select Clear browsing data. A popup window will appear. You’ll want to select All time as the time range, and check the box for Cached images and files.

Lỗi 502 khi filter trong woocommerce của googler năm 2024

Then, just click on the Clear data button and your cache will be emptied. This will free up space for new data.

You may also want to check your Domain Name System (DNS). Like your browser cache, clearing your DNS could be a quick fix if there’s an issue with an IP address.

To clear your DNS, simply open the command prompt and type in the following command:

C:/Users/example>
C:/Users/example>ipconfig /flushdns

Lỗi 502 khi filter trong woocommerce của googler năm 2024

After clearing your cache and DNS, try refreshing the page to see if the problem has been resolved. If it’s still there, you can move on to the next method.

3. Deactivate your plugins and theme

If the 502 Bad Gateway error cropped up after installing a new theme or plugin, it’s possible that one of these programs could be the culprit. A poorly coded or incompatible plugin could cause a conflict that results in a server being slow or unable to communicate.

To find out if this is the case, you’ll need to deactivate your plugins. If you still have access to your site, go to your WordPress admin area and navigate to Plugins. Then, select and deactivate any new plugins you’ve installed:

Lỗi 502 khi filter trong woocommerce của googler năm 2024

Alternatively, you can deactivate all of your plugins at once to see if the issue resolves itself. If it does, you’ll have to reactivate your plugins one at a time in order to see which one is acting up.

If you’re unable to access your WordPress admin dashboard, you’ll need to go through a backdoor to manually deactivate your plugins without logging into wp admin. You have two options: connect to your website via the File Manager in your hosting account, or use a File Transfer Protocol (FTP) client like FileZilla.

We’ll be using FileZilla to show you how to connect to your site’s back end and deactivate your plugins. You’ll need to enter your credentials, including username and server address. You can obtain this information from your hosting account.

Once you’ve connected to your site, you’ll need to navigate to the root folder. This contains all of your site’s files, and is normally called www, public, or public_html.

Then, open your wp-content folder and locate the plugins folder.

Lỗi 502 khi filter trong woocommerce của googler năm 2024

Next, rename the folder from plugins to something else, like plugins_old. This will break the pathway and all plugins on your site will be deactivated.

Now, try to refresh your page. If the issue hasn’t been resolved, then your plugins are not the culprit and you can rename the folder back to plugins to reestablish the pathway.

If deactivating the plugins resolves the issue, you’ll need to find out which one is at fault. To do this, rename the plugins folder back to its original name. Then, rename the folders for the individual plugins and keep refreshing the page until you find which one is causing the error.

Lỗi 502 khi filter trong woocommerce của googler năm 2024

Renaming each individual folder will break the pathway to just one plugin, rather than all of the plugins at once. Once you have identified the faulty plugin, you can access your WordPress admin dashboard to address it accordingly. For instance, you might decide to delete the plugin and install an alternative.

You can follow a similar procedure to check your themes. These are located in the themes folder within wp-content.

If the problem persists after deactivating your plugins and theme, you can rule out bad code as the cause. Let’s look at a few other possible solutions.

4. Check your updates

WordPress developers are constantly updating plugins and themes to fix bugs, improve features, and solve security issues. It’s crucial to keep your site updated not only for security, but also to avoid compatibility issues.

Some themes and plugins are only designed to be compatible with certain versions of WordPress. When installing a new tool, you’ll want to check the required WordPress version.

In the example below, you can see that a WordPress version older than 5.0 or newer than 5.9.1 may not be compatible with the plugin.

Lỗi 502 khi filter trong woocommerce của googler năm 2024

This could lead to unexpected behavior from the plugin. Incompatibility issues can cause crashes, long loading times, and time outs that could result in the 502 error.

You can check your current version of WordPress by navigating to Home → Updates in your dashboard.

Lỗi 502 khi filter trong woocommerce của googler năm 2024

While you’re here, you can run any necessary updates. You might also want to go to your Plugins page to make sure that all of your software is up to date.

5. Disable the CDN or firewall

If you’re using a content delivery network (CDN) for WordPress, this may increase the chance of a 502 Bad Gateway error as data is being transmitted from and through multiple servers. If there’s a problem with any of these gateways, it could result in an error.

To rule this out, you can disable your CDN to see if there are any changes. If you’re using a plugin to integrate a CDN, simply deactivate that plugin as shown above. If your CDN comes with its own page on your dashboard, there’s likely a setting that allows you to disable it directly.

Security services like firewalls can also cause the 502 Bad Gateway error. These extra layers of security often rely on additional gateways which can fail or delay the request long enough to time out and cause an error. Turning off your firewall temporarily can help you rule out this as a cause.

Explore the benefits of Jetpack

Learn how Jetpack can help you protect, speed up, and grow your WordPress site. Get up to 52% off your first year.