How To Fix 502 Bad Gateway Error (Nginx/Cloudflare/WordPress)

Almost everyone uses internet these days, and with the increase in number of internet users, new browser apps are being introduced too.

While there are hundreds of web browsers available over the internet, and each have their own unique feature like Google Chrome is well-known web browser for speed, Mozilla Firefox is known for security, while browsers like UC comes handy in surfing the web without ads.


The one thing that remains same in all browsers is 502 bad gateway error. Doesn’t matter which browser or ISP (Internet Service Provider) you’re using, you can encounter this problem.

Error 502 bad gateway is basically related to servers and not the device you are using. Though you can perform some tasks to fix 502 bad gateway error.

If you have encountered http error 502 bad gateway, and looking for ways to fix 502 bad gateway problem, then you have landed on the correct page. Among all of the internet error codes show, the Error 502: Bad Gateway message is the most annoying error you will ever face.

Fixing http error message 502 is easy, but if you don’t know about it, then don’t worry.

Here in this post we are going to tell you about how to fix 502 bad gateway nginx error, what causes error 502 bad gateway and general information about it.

So, let’s get started.

What Is A 502 Bad Gateway Error

502 Bad Gateway Error is basically server side error. When your system gets no response from the server on the web, it disp http lays bad gateway error 502. “Bad Gateway 502” is most prevalent, while “Proxy Error” or “Gateway Error” are also common.

There are very possible chances that the entire website or some pages of website are taken down without warning, or is down for maintenance, you might get 502 Bad Gateway Error. This error is among other 500-series errors.

Also read Another best Error related article:

Causes of Error 502 – Bad Gateway

Here are some of the reasons or causes of 502 bad gateway error. Though it differes from system to system about which problem they are facing. Most commonly, a 502 gateway error is caused by following reasons:

  1. An incorrect URL.
  2. Depending on your web browser, an isolated browser error can sometimes be the cause.
  3. Corrupted internet data, in your browser’s cache.
  4. Network errors in the router or modem hardware.
  5. Operating system error, due to outdated OS release.
  6. Bad DNS lookup information.

502 Bad Gateway Error Variations

If you have used Twitter, then sometimes you might have encountered “Twitter is over capacity” error, it is basically a 502 Bad Gateway error. Wile a bad gateway error code 502 appeared in Windows Update will be shown as 0x80244021 error code or the message WU_E_PT_HTTP_STATUS_BAD_GATEWAY.

Most of the error codes indicate specific problems, so everyone can find it easy to look for a solution. If you are facing 502 bad gateway error, then there are chances that you are getting some different kind of error message. Though solution remains same. Below we have shared a list of error 502 bad gateway variations which you can look to find perfect solution of your problem:

  • 502 Bad Gateway
  • 502 Service Temporarily Overloaded
  • Error 502
  • Temporary Error (502)
  • 502 Proxy Error
  • 502 Server Error: The server encountered a temporary error and could not complete your request
  • HTTP 502
  • That’s an error
  • Bad Gateway: The proxy server received an invalid response from an upstream server
  • HTTP Error 502 – Bad Gateway

How To Fix 502 Bad Gateway Error (Nginx/Cloudflare/WordPress)

Method #1. Re-load The Web Page or Use Cache

If you are getting a 502 bad gateway error, then first thing you can do to fix it is try reloading the web page. There are possible reasons that the website might be down or overloaded and can simply gets opened when you reload (F5 or Ctrl + F5) it. When you will reload the website, servers might come right back. If you are still facing same problem 502 gateway error, then try using other web browser.

Another thing you can do to fix Nginx 502 bad gateway error is to use the cache of the website. Every web page in Google have save copy named Cache. Which you can visit and open if you are not able to get to live version. If you don’t know about it, then you can follow the steps mentioned below to fix error 502 bad gateway easily:

  • First of all open
  • Now type cache: + website/page URL you want to visit and press enter. For example:
  • Doing this will open saved cached copy of website or URL for you.
  • Moreover you can also try visiting the website not be entering it’s URL, but by using website’s IP address.

Method #2. Clear Your Browser Cache

If you’re using a browser from so long, then your browser might have become a junk for all websites cache you’ve visited. It is very easy to clear browser’s cache and most web browsers have dedicated option for it. If you want to fix gateway error 502, then you can follow the steps mentioned below to clear web browser cache:

  • First of all press CTRL + H to open Web Browser History. This key works on almost all browsers.
  • Now if you are using Chrome, then you will find an option “Clear Browsing Data” on the left panel.
  • Click on it, and a new tab with pop-up window will appear on your screen.
  • Now don’t forget to select “the beginning of time” option from drop down menu.


  • Once you have selected it, choose the options you want to clear. Recommended are Browsing history, download history, cached images and files, cookies and other site data and hosted app data.
  • Now click on Clear browsing data button and wait for the process to finish.
  • Once done, just close your browser and restart your system to make changes to it.
  • When you will open the same website again, the problem bad gateway error 502 will be fixed.

Method #3. Open Web Browser or Website In Safe Mode

Windows Safe Mode and Browser Safe Mode are two different things, so don’t mix them. Starting Windows in safe mode won’t help you if you want to troubleshoot 502 bad gateway error. If you want to start browser in safe mode, then follow the steps mentioned below:

  • First of all create a shortcut of Chrome icon on the desktop.
  • Now right click on the newly created shortcut icon and select Properties.
  • Now visit the Shortcut tab, and find field named Target.
  • Just add “–incognito” (without quotes) at the end of the command.

  • Now click on Apply, and then on OK to save your settings for this shortcut.
  • Open browser by double clicking on this modified icon, and visit the same website to check if this fix 502 Bad Gateway Error or not.

Method #4. Disable Proxy and Unnecessary Extensions

When it comes to browser errors there are many link-ups between system and browser you can’t think about in general. Similarly, a 502 bad gateway error Windows 10 could be linked to proxy and extensions you are using. Moreover to fix 502 gateway error you can try disabling proxy settings along with web browser extensions. Here’s how to do it.

  • First thing is to open the RUN dialog box. Just press Windows Key + R, and RUN box will appear.
  • Now type “inetcpl.cpl” (without quotes) in the RUN box and hit enter.


  • A new pop-up window will appear on your screen with many settings related to internet.
  • Head over to Connections tab and click on LAN Settings.
  • Another small dialog box will appear with LAN Settings including Proxy Server settings.
  • Simply uncheck the use a Proxy Server for your LAN option if it is checked.


  • Another thing which you should check is that option “Automatically Detect Settings” is checked. If not, then do it.
  • Now click on Apply and restart your system to make changes to it.

How to disable extensions in Google Chrome: If you will install web browser extensions in your browser, then some of them might not work properly. Hence you will face error 502 bad gateway problem. If you want to fix this problem, then you can also try disabling some of the extensions to make the website work again.

  1. First of all open Chrome and click on three dots from the upper right corner of the screen.
  2. Now click on More Tools and then on Extensions.
  3. This will take you to a new extensions page with installed and disabled extensions.
  4. From this list you can try disabling or uninstalling extensions one by one to check if problem is fixed or not.


Method #5. Flush DNS and Reset TCP/IP

If none of the above mentioned methods worked for you, and if you’re still facing 502 Bad Gateway problem, then try resetting DNS and TCP/IP settings. It is very easy to flush DNS using command prompt and reset TCP/IP settings of your system. By following below steps, you’ll be able to flush DNS and TCP/IP settings of Windows. By end, you will be able to solve 502 bad gateway problem error.

  • First of all open CMD (Command Prompt) with administrator rights. To do this, search CMD, right click on CMD and choose Run As Administrator.
  • Now you will have to run below 3 commands one by one.
  1. ipconfig /release
  2. ipconfig /flushdns
  3. ipconfig /renew


  • Now close the CMD window and open it again with Administrator rights.
  • You have to run 4 CMD commands to flush TCP/IP and DNS settings.
  • Just type these commands one by one and press enter after each command
  1. ipconfig /flushdns
  2. nbtstat –r
  3. netsh int ip reset
  4. netsh winsock reset

  • Simply restart your system now, and you 502 Bad Gateway Error will be fixed.

Final Words

502 Bad Gateway error can be problematic sometimes, and if you won’t pay attention on it on time, you may lose access to all websites. The proxy will receive invalid response from the server, and hence show 502 bad gateway error problem. If you are facing 502 proxy error or 502 http bad gateway error problem, then you can try following the methods mentioned above.

Do note that all of the above mentioned methods on how to fix a 502 bad gateway error are tested by us, and working fine. You can follow each of them to solve HTTP Error 502 – Bad Gateway error on PC. So we hope now you have http error 502 bad gateway fixed. If you know some more methods about how to fix 502 bad gateway error, then do let us know about them via comments below.

Some other best article for you:

Add Comment