Complete Guide of 502 Bad Gateway Error

You use the Internet and browse different websites, you may face 502 bad gateway error which is actually an HTTP response codes. This error tells us one server on the internet found an invalid response from another server. The results of code have a great relationship between the client and web application. So, we will discuss the solution of 502 bad Gateway errors, in this article. When you see 502 bad Gateway error, it means the website has a problem, not your browser or your devices that has been using.

502 bad Gateway errors show that edge server the edge server act as a proxy. It was not suitable to get the logical response from the original server. This original server is also called upstream server.

You can see this type of some error message when you try to open something in the Google. But Google cannot open the site as your wish and show this type of message. These are examples of 502 Bad Gateway errors.


  • In Twitter, this error message shows in this form.



  • When one server found an invalid response from another server.


  • We see this variation of 502 bad gateway error when a Web server got an invalid response while behaving as a gateway or proxy server.



There are many types of 500 error status code like 501,502 etc. These errors have the different meaning as compare to the 502 Bad Gateway error. These errors show that request of users has accepted but the server cannot fulfill this request. But in the 502 Bad Gateway error shows that the server act as a proxy or Gateway that has not received an invalid response from the server. There is few more example of 502 Bad Gateway. You can see in different browsers, web servers, and operating system. These errors are representing in a different way but they have same meaning and reason of occurrence.

Different Variations of 502 Bad Gateway Error:

Here is the list of 502 bad gateway error which we see on the web.

  • 502 Bad Gateway
  • Error 502
  • HTTP Error 502-Bad GateWay
  • 502 Services Temporarily Overloaded
  • 502 Proxy Error
  • A black white screen
  • “502 Server Error” In this Error show the server cannot complete the request.
  • HTTP 502.

Reasons for Occurrence 502 Bad Gateway Error:

These errors are occurred due to many reasons. These are following below.

  • Server Overloaded by visitors:

When a good number of users visit one website at one time then at that time the server becomes overloaded. The server can jam due to dead memory and overloaded visitor of one site or DDOS attack.

  • Firewall Blocks Request Between Servers:

Firewall blocks all the request and communication between server’s edge and origin. Some DDOS provides protection system can overreact and block request from the content delivery system.

  • Defective Programming:

An Error in website’s code occurs its show that request cannot answer correctly.

  • Networking Problems:

Networking problem is also one reason for 502 Bad Gateway error like DNS, routing and ISP problems cause this error.

How to fix 502 Bad Gateway Error:

A 502 bad Gateway Error occurs due to networking and server related problems. It also called client-side problem. Mostly this type of error is resolved only refresh the web browser if this problem occurred due to the overloaded server. If you cannot resolve the issue then you can check the reason of the problem.
Here I will discuss many solutions for you to handle this problem.

Solution 1: Fixes Reloading

This is the very easy method to resolve the issue of 502 Bad Gateway errors by reloading page of browsers or website. If this problem occurs you will wait for a minute then reload the page by pressing an F5 or Ctrl + F5  or clicking reload /refresh button of the URL. Through this action host or server will be overloaded and the site will come back at that time.

You have 2nd option to resolve the issue past the URL of the website on this website This website will also tell the main problem behind your 502 Bad Gateways error. You come to know that this website will be down or have a problem.


You have a 3rd option you should close browser window then again open the window of the browser to start a new session of the browser and try to open the desired webpage again.

Solutions 2: Fix DNS Problems

When the domain of the website cannot resolve the correct IP then the user faces the problem of 502 Bad Gateway error. If you want to shift any website like WordPress in any new host, it will take 24 hours to for propagated all the things. It depends upon the TTL value of your DNS records. You can also try flushing your local DNS cache. You can easily change and DNS Server also assigns the ISP.


  • Now you will see successfully flushed the DNS Resolver cache message.
  •  For Mac Users, they need to write the command dscacheutil -flushcache to flushed the DNS cache.

Solution 3: Checking Host of Website

This problem is also occurred due to the web host. Sometimes the request of the website takes a long time for acceptance but during this time it became canceling or killed by the server. Because most of the websites use hosting from the shared host that is implementing a kill script. Due to this kill script, it will cancel the request after some time.502 Bad Gateway occurs on those websites that are shared host like Twitter. On another hand those website run privately they have own SQL, LINUX, and PHP, it cannot depends on the shared host. That cannot receive 502 Bad Gateway.

Solution 4: Temporary Disable Content Delivery Network (CDN)

If you will use 3rd party CDN, it also gives you an easy way for troubleshooting. Though this you can easily disable CDN temporary. If you can use CDN enabler Plugin then you deactivate Plugin at the same time. Now you want to test the site. You will see the dashboard of the site cannot access. You will login the site via STFP and rename the old enabler Plugin for access the site. This is the CDN disable the connection.


Solution 5: Browsers Cache should be Clear

Out of dated and corrupt file and data store on the different browsers of the cache can be the reason of 502 Bad Gateway error. So, it is better for you to clear the browser history. You can also clear the browser’s cookies to fix 502 Bad Gateway error. Then you will run the browser in a safe mode. You used a default setting of the browser for resolving this issue.

Now you will read instruction for clearing the Cache of browsers. As we know there are different browsers which we can use. Some people like to use Google Chrome, some like Mozilla Firefox, Opera, Safari, Internet Explorer and Microsoft Edge.
Here you will acknowledge the way to clear the cache of every browser.

  • Clear Cache of Google Chrome:

  • Firstly, you will click on the three dots icon which is showing in the right corner of the browser of the window.
  • Now you should find more tool option then select clear browser data from the submenu.


    • You can use the 2nd option of deleting the history of the Google Chrome browser by pressing CTRL +SHIFT+DEL for open popup window for clear Browsing Data.

Clear Cache of Mozilla Firefox Browser:

  • You can select the Hamburger icon that is located on the right corner of the browser’s window.
  • Select History. After that select Clear Recent History.



  • You can open popup window by pressing CTRL+SHIFT+DEL. Then you can select Everything in a time range to clear drop-down.
  • Then make sure that you will select an only cache checkbox and click on Clear Now for clear Cache.



Clear Cache for Safari:

  • For delete, the history go Safari then Clear history.



  • If you want to clear browser history and cookies etc. then you will have a need to enable a Develop menu off by going to Preferences => Advanced by checking the Show Menu bar box.


  • Go to Develop => empty Caches for clearing Safari browser.



Clear Cache for Internet Explorer:

  • Firstly you can click Gear icon that is shown on the top right corner in the Tool menu.
  • Then you can find safety => Clear Browser history.



  • Internet Explorer opens the popup window by pressing the shortcut key CTRL+SHIFT+DEL.
  • Then you select the Temporary Internet files and website to protect important data.
  • Click the button of Delete for clearing cache.



Clear Browser Cache for Microsoft Edge:

  • Click three dots icon located in the top right corner of browser window.
  • Go to Setting => click on want to choose what to clear.


  • Then select Cache Data and file to delete all kinds of data.
  • Select clear button.
  • You can use the shortcut option for clearing history by pressing CTRL+SHIFT+DEL.


Clear browser Cache in Opera:

  • Click on opera icon in the top left corner and find Setting or more tools.
  • Then select browsing data from the submenu.
  • You should select Obliterate the following items from equal to at least 4 weeks.
  • Check the Cached images and files then select the Clear Browsing Data.


Hopefully, this article will provide help to resolve the problem of 502 Bad Gateway Error. Reading this article, you will come to know the reasons of 502 Bad Gateway Error and their possible solution. if you have any question then let me know in the comment box.