Skip to content

502 Bad Gateway: WordPress Error Explained and Fixed

Looking for a way to fix the 502 bad gateway WordPress error? 🐞

Although it’s a common WordPress issue, it’s hard to pinpoint the exact cause of the 502 bad gateway error. Typical causes include server overload, browser problems, firewall blocks, etc.

Not knowing the exact cause makes it hard to implement a solution. But don’t worry, in this article, we have covered all the possible solutions for removing the 502 error from your WordPress website. What you need to do is carry them out one by one and see which one works for you.

Let’s get started.

502 bad gateway WordPress error: Meaning, causes and variations

The 502 bad gateway WordPress error typically appears when you are trying to load a page or post on your WordPress website. Let’s take a quick look at what it means, why it appears, and the variations of the error that many of you are encountering.

502 bad gateway wordpress.

What does the 502 bad gateway error mean?

To understand the 502 error, you need to first understand how a web page loads. When you open a page, the browser makes a request to the site server.

The site server is where the files and folders of your WordPress website are hosted.

The server usually responds with the content requested by the browser. But sometimes the server is unable to fetch the content for reasons like server overload, firewall blocking, browser issues, etc. That’s when the server shows the 502 bad gateway error.

What causes 502 bad gateway WordPress error?

Common causes for the 502 bad gateway WordPress error are:

  • Server overload: When the server receives too many requests, it gets overloaded and fails to respond properly, resulting in a 502 error
  • Browser issues: Outdated browsers or corrupted files in the browser cache can cause the error
  • Firewall blockage: The firewall installed on your website could be blocking your internet provider or your IP address triggering the error
  • Temporary server issues: The server may be temporarily down causing the 502 error

502 bad gateway error variations

The 502 bad gateway error 💣 may look different on different websites. These are some common variations of the error:

  • Error 502
  • HTTP 502
  • 502 Proxy Error
  • 502 Bad Gateway
  • 502 Bad Gateway NGINX
  • HTTP Error 502 Bad Gateway
  • 502 Service Temporarily Overloaded
  • 502 Server Error: The server encountered a temporary error and could not complete your request
  • 502. That’s an error. The server encountered a temporary error and could not complete your request. Please try again in 30 seconds. That’s all we know.

Now that you know what the 502 bad gateway WordPress error means, why it occurs and the many variations of the error, let’s learn 👨‍🎓 how to remove it from your site.

How to fix the 502 bad gateway WordPress error

To fix the 502 bad gateway WordPress error, you need to take the following steps:

  1. Reload your web page
  2. Clear browser cache
  3. Flush DNS cache
  4. Check for hosting server
  5. Disable CDN and firewall
  6. Update the PHP version
  7. Audit plugins and themes
  8. Seek help from your hosting provider

⚠️ Important: After implementing each solution, check your website. When the 502 error no longer appears on your site, there is no need to proceed with the rest of the tutorial.

1. Reload your web page

The 502 error could have been a temporary glitch that got resolved on its own. For example, your site’s server might have already recovered from being overloaded.

Reloading the page will verify whether the error persists on your website.

2. Clear browser cache

Browser caching is a technique used by web browsers to store copies of site’s static files on a user’s computer or device. By storing these resources locally, the browser can quickly retrieve and display the page whenever the user decides to revisit it. In this way, the user gets web pages served quickly, and the user experience improves on the browser.

The downside of this technique is that it can cause issues if there’s a problem in the cache. So even if the 502 bad gateway WordPress error no longer exists on your website, you might still see it because you are being shown a cached version of your site.

You need to clean your browser cache and check whether the error was a temporary glitch!

👉 Here’s how to clear the browser cache in Chrome:

  1. Click on the three dots icon in the top-right corner.
  2. Expand the More Tools option in the drop-down.
  3. Select Clear Browsing Data in the list of options.
  4. Choose All time as the Time range.
  5. Check the box for Cached images and files (and uncheck the other boxes).
  6. Click the Clear data button.
How to clear browser cache to fix 502  bad gateway WordPress error.

Themeisle has a guide on how to clear browser cache in other browsers.

If the error persists even after removing the cache, proceed with the next solution.

3. Flush DNS cache

You already know what a cache is. To learn what is a DNS and why you need it in a WordPress website, take a look at this article.

After you have a good grasp on DNS, proceed to follow the steps below to flush your DNS cache:

On a Windows computer, open the Command Prompt, insert this command:


Hit enter to run the command and your DNS cache will be cleared.

flush dns command prompt.

On Mac OS, launch the Terminal and run this command:

dscacheutil -flushcache

Now, open your website and check whether the 502 bad gateway error is gone. Seeing it still? Try the next solution.

4. Check for hosting server issues

Sometimes, hosting companies take websites offline intentionally because their system is undergoing security checks or maintenance work. They inform users about it beforehand via email or by sending notifications to user hosting accounts.

We recommend that you check for an email from your hosting provider or directly visit your hosting account and look for a notification regarding downtime.

bluehost maintenance notification email.

If it’s an expected downtime, then there’s no point in proceeding with the tutorial. Just sit back and wait for the work to end, and your website should be up and running in no time.

You can also reach out to your web host’s support staff and ask them if your host is experiencing any known issues.

5. Disable CDN and firewall

Services like a content delivery network (CDN) and firewall prevent malicious visitors from accessing your website.

On rare occasions, these services are known to end up accidentally blocking legit visitors.

That means you could be seeing the 502 bad gateway error because your CDN or firewall has mistakenly identified you as a malicious visitor.

We recommend disabling any CDN and firewall installed on your site and checking whether it helped remove the error.

If that fixes the problem, you might need to change something in the service’s configuration or switch to a different service.

6. Update your PHP version

Some WordPress errors (including the 502 error) are triggered by outdated PHP versions.

You need to check whether your site is running on an outdated PHP version and then update it if needed. Your web host will assist you in doing this.

7. Audit themes and plugins

The themes and plugins installed on your WordPress website could be conflicting with each other or they could be taking too long to execute. Whatever the reason, you need to find the culprit plugin or theme and remove it for good.

To check whether your current theme is the culprit, you need to deactivate it by switching to a default WordPress theme (like Twenty-Twenty-Three, Twenty-Twenty-Two, etc.).

If you can’t access your WordPress dashboard, you can manually deactivate your theme or plugins by going to the backend of the site via an FTP client or your hosting account.

Audit themes and plugins via your hosting account

Open your hosting account and go to cPanel → File Manager → public_html → wp-content → themes.

Inside the theme folder, locate the current theme.

Right-click on the current theme folder, select the Rename option and then rename the theme to something like “disabling-theme.”

rename option themes folder file manager.

This will disable the current theme and your WordPress website will automatically switch to one of the default themes.

If your current theme was the culprit, then your website should now be back to normal. If it wasn’t, then the culprit could be one of your plugins.

You can quickly test this theory by disabling all your plugins and checking whether it removes the 502 error from your website.

To disable all plugins go to cPanel → File Manager → public_html → wp-content → plugins.

Right-click on the plugins folder and rename the folder to something like “disable-plugins.”

renaming plugins folder.

Now, open your website and look for the error. If it’s gone, then it confirms that one of your plugins is the real culprit.

To locate the culprit plugin, revert to the original name of the folder (i.e., “plugins”) and open the folder by double-clicking on it. It contains all the plugins installed on your WordPress website.

wordpress site plugins in file manager - 502 bad gateway WordPress.

Start renaming the plugin folders one by one to disable the plugins installed on your site. Every time you rename/disable a plugin, check your website. At some point, the 502 error will be gone, and you will know which plugin was causing the issue.

As soon as you find the culprit plugin, be sure to delete it immediately.

8. Seek help from your hosting provider

After implementing all the solutions listed above, if the 502 bad gateway WordPress error persists, then you need to seek help from your hosting provider.

Be sure to tell them about all the steps already taken to remove the error. They will find a solution and get your website up and running in no time.

Fix the 502 bad gateway WordPress error for good! 🙋‍♂️

The 502 error is a common WordPress error, and it typically appears on a website due to reasons like server overload, browser issues, and firewall blockage, among other things.

⚙️ To fix the error, you need to take the following steps:

  1. Reload your web page
  2. Clear browser cache
  3. Flush DNS cache
  4. Check for hosting server
  5. Disable CDN and firewall
  6. Update the PHP version
  7. Audit plugins and themes
  8. Seek help from your hosting provider

👉 To fix another common 500-level WordPress error, you also might be interested in our WordPress 500 internal server error troubleshooting guide.

If you have any questions about the ‘502 bad gateway WordPress error’, let us know in the comment section below.

Sufia Banu

Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

25 Best Free WordPress Themes (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...