How to Fix 502 Bad Gateway WordPress Error

How to Fix 502 Bad Gateway WordPress Error

502 Bad Gateway WordPress error is one of those errors you are likely going to see if you use WordPress long enough. It’s a proxy error that happens quite frequently, and chances are you have experienced it on several occasions.

502 Bad Gateway Error

502 Bad Gateway issue is a server error. That is to say, the error originates from the webserver of a site, and not your machine.

It is indicative that a server encountered difficulties processing a request coming from your browser.

Though a temporary error, Bad Gateway error can be frustrating. It affects WordPress sites as well as non-WordPress sites.

Thankfully, this error can be fixed. In this article, we will be sharing with you some of the methods for fixing Bad Gateway Error.

Understanding the 502 Bad Gateway Error: A Simple Guide

Have you ever stumbled upon a “502 Bad Gateway” message while browsing the web and wondered what it means? Let’s break it down in simple terms.

What is the 502 Bad Gateway Error?

Imagine you’re sending a letter through a series of mailboxes (servers) to reach a friend (the final website you want to visit). The “502 Bad Gateway” error is like getting a note back at one of the mailboxes saying, “Sorry, your letter couldn’t be delivered because of a mix-up at the next mailbox.”

In technical terms, this error happens when one server on the internet sends a request to another server but gets a confusing or incorrect response back.

How Does It Occur?

  • You Ask to Visit a Site: You type in a website address or click on a link. This is like sending a request or “letter” to the website’s server asking to see the webpage.
  • Servers Talk to Each Other: Sometimes, the website’s server needs to ask for information from another server to show you the webpage. This is common for websites that pull in data from multiple sources or use external services to function.
  • Something Goes Wrong: The error pops up when the website’s server doesn’t get a clear response from the other server it talked to. It’s like one mailbox not understanding the request from the previous mailbox, causing a hiccup in delivering your “letter.”
  • You See the Error: Instead of the webpage you wanted, you see the “502 Bad Gateway” message. This is the website’s way of saying, “Something went wrong in getting you what you asked for.”

Why It Matters

While this error might sound technical, it’s a common part of the internet’s communication process. Understanding it helps in knowing that it’s usually a temporary issue, often fixed by refreshing the page or waiting a bit. If you manage a website and see this error often, it might be time to check with your web hosting service to ensure everything’s running smoothly behind the scenes.

Different Variations of 502 Bad Gateway Error

Bad Gateway error comes in different forms, with each slightly different from each other. They are as follows:

  • Bad Gateway NGINX
  • 502 Bad Gateway Cloudflare
  • HTTP Status Code Error
  • 502 Service Temporarily Overloaded
  • HTTP Error 502
  • Server Error 502: The server encountered a temporary error and could not complete your request
  • 502. That’s an error

While 502 is the most common error code indicative of a server problem, there are many other error codes that point to the same problem. They are 500, 501, 503, and 504 error codes.

Depending on the website you are visiting, the error messages will be displayed differently.

For instance, you might have seen this screen while on Twitter.

Twitter Error


This is a typical HTTP 502 error, indicative of something wrong with Twitter servers.

On Google, the error is displayed as follows.


Yet another gateway error displayed differently.

What Causes 502 Bad Gateway Error?

When a 502 error occurs, a couple of factors might be responsible. A few of them are discussed below.

Heavy Traffic

A sudden spike in traffic to a website can cause the webserver to malfunction. When this happens, the server becomes temporarily overloaded. The result is a connection breakdown between the proxy and the upstream server.

The Proxy or Upstream Server Becomes Inaccessible

If the proxy server, whose primary job is to act as a signal receiver, becomes inaccessible, the end result is 502 Gateway error. The same goes for the upstream server.

These servers may go down because of a power outage, poor internet connectivity, etc.

Outdated Browsers

A browser that is outdated may fail to function as it should. A dysfunctional browser, more often than not, experiences caching problems. This, in addition to signal flow and database connection problems, causes a 502 error.

Firewall Security Problems

Certain DDoS protection systems often become the cause 502 error problem. Rather than guarding against DDoS (Distributed Denial of Service) attack, for which they were designed, they take things a bit too far.

They end up setting up a firewall between the proxy and upstream server, thus blocking off the communication between them.

How to Resolve 502 Bad Gateway Error

While it’s true that 502 Bad Gateway is a server-side HTTP error, there are a couple of things you can do to get it fixed. Let’s see a few of them.

Refresh Your Browser To Clear 502 Bad Gateway

This one is your first point of call. Simply reloading the webpage can clear up this error. Like we earlier said, poor internet connectivity issues can cause a 502 error.

If that’s the case, reloading the page after a minute or so can help.

Clear Your Browser’s Cache And Cookies

If after reloading the webpage repeatedly you still have this error, another thing you should do is clear your browser cache.

It might be that a piece of data stored on your computer is causing the browser to malfunction.

To clear your browser cache, on the P.C, press Ctrl + Shift + Delete. This works for Chrome, Mozilla Firefox, and Internet Explorer.

Then select cache and/or cookies, click Clear Data.

Cache and Cookies

Another way to do it is by performing a hard refresh. Simply hold down the Ctrl + F5 keys.

Run Your Browser in Safe Mode

Chrome, Firefox, and Internet Explorer can be opened in safe mode. For Chrome, simply click Ctrl + Shift + N on the P.C to launch the incognito mode.

For Mozilla Firefox, simply hold down the Shift key on the PC, and double-click the browser icon.

It is a bit different for Internet Explorer. First, you have to press Windows key + R. Next, type iexplore-extoff.

Running your browser in safe mode will force all extensions and add-ons to be disabled. If this method works, know that an extension/add-on on your browser is causing the problem.

Deactivate and Delete Duplicate Plugins Possibly Causing 502 bad Gateway

At times, having two plugins that serve the same function can cause server error. This is very common with caching plugins.

So, if you have a duplicate plugin on your WordPress site, uninstall it. This is also applicable to redundant plugins you aren’t using. Don’t leave them lying around on your site. Instead, delete them.

If this still doesn’t work, temporarily disable all your plugins to see if a particular plugin is a problem. If this error is preventing you from accessing your Dashboard, you will need to disable plugins manually.

Check Your Server’s DNS Settings

If you recently moved your website to a new host, this move will change where your DNS servers point to. This also happens when your website’s IP address is changed.

If this is the source of the problem, the simplest thing to do is to wait for 24 hours for the DNS changes to resolve on its own.

Alternatively, you can try your hands on another DNS service provider to see if things will work. A good example is Google public DNS.

Turn Off Your CDN

If you run your website on a Content Delivery Network, there is a good chance the problem might be coming from there.  Often times, firewall block off requests from a CDN.

As such, temporarily turn off your CDN and see if it will fix the issue. If it does, check your firewall configuration and make necessary corrections.

Restart Your Computer

Though simple, this works especially if poor connectivity is the culprit. If you are working with networking equipment, also restart it.

Contact Your Hosting Provider

If you have tried all these steps and nothing works, simply reach out to your hosting provider. They have the expertise and skill to diagnose and resolve the 502 error problem.

How 502 Errors Can Affect Your Website’s SEO

Ever wonder if those pesky “502 Bad Gateway” errors could be more than just a temporary nuisance? Well, they can, especially when it comes to your website’s search engine ranking. Let’s dive into how these errors might impact your SEO.

The SEO Impact of 502 Errors

  • Visitor Experience: First things first, search engines like Google want to provide users with smooth and efficient experiences. If your site frequently shows 502 errors, visitors might leave quickly. This increases your bounce rate, which is a red flag for search engines.
  • Crawling Issues: Search engines use bots to “crawl” and index your website’s content. If these bots encounter 502 errors, they can’t access your pages. This means your content might not get indexed or updated in search results.
  • Site Downtime: Occasional 502 errors might not be a big deal, but if your site is down often or for long periods, it’s a problem. Search engines might see your site as unreliable and lower its ranking.
  • Lost Opportunities: Every time a potential visitor encounters a 502 error, it’s a missed opportunity for engagement, conversion, and sharing. Over time, this can lead to decreased traffic and visibility.


Bad Gateway error can be frustrating, but there are a couple of things you can do to have it resolved.

We’ve shared a list of them in this article. Some are so simple that all you need to do is to click one or two buttons.

The last resort is reaching out to your hosting provider if the problem persists. They can usually identify the source of the issue and help you fix it.

FAQ: Understanding the 502 Bad Gateway Error

What is a 502 Bad Gateway Error?

A 502 Bad Gateway Error occurs when one server on the internet receives an invalid response from another server. It’s like a communication error in the chain of servers working to load the webpage you requested.

Why do I see a 502 Error?

You might see this error due to server overload, network errors, DNS issues, or problems with the website’s configuration. It’s often a temporary issue that can be resolved by refreshing the page.

Can I fix a 502 Error on my own?

If you’re a visitor, try refreshing the page, clearing your browser cache, or coming back later. Website owners should check their server and website configuration or contact their hosting provider for assistance.

Does a 502 Error affect my website’s SEO?

Frequent or prolonged 502 errors can negatively impact your website’s SEO by affecting user experience and preventing search engine bots from crawling and indexing your site properly.

How long do 502 Errors last?

The duration can vary. Some errors are resolved by simply refreshing the page, while others might require more in-depth troubleshooting by the website owner or hosting provider.

Should I contact my hosting provider about a 502 Error?

If you’re a website owner and the error persists or happens frequently, it’s a good idea to contact your hosting provider. They can help identify and resolve server-side issues causing the error.

Can a 502 Error be caused by my internet connection?

While it’s less common, network issues on your end could contribute to a 502 Error. Try accessing the site from a different network to rule this out.

More Resources:

 This post was written by Mesheal Fegor

Mesheal Fegor is a Web/WordPress Developer and technical writer. His WordPress help articles have been featured on Kinsta and other sites. Mesheal holds a master's degree in computer science. His writing focuses on technical WordPress issues, ranging from core WordPress problems, to issues with WooCommerce, and more.

Last edited by: FixRunner Team