The 502 Bad Gateway error is an HTTP status code that means that one server on the Internet received an invalid reply from another server. The 502 Bad Gateway errors are entirely independent of your particular configuration, which means you can see one in any browser, in any operating system, and on any device. That is, it can be customized by each website. While it is quite common, different web servers describe this error differently.
Next, I show you a list of some common ways we can see it.
The 502 Bad Gateway error seems within the Internet browser window, just like web pages.
For example, Twitter’s famous “whale bug” that says Twitter is above capacity is a 502 Bad Gateway error (although an Error 503 would make more sense).
A 502 Bad Gateway error received in Windows Update generates an error code of 0x80244021 or the message WU_E_PT_HTTP_STATUS_BAD_GATEWAY.
When Google services, such as Google Search or Gmail, experience a 502 Bad Gateway, they often show Server Error, or sometimes just 502, on the screen.
Cause of a 502 Bad Gateway error
Lousy Gateway errors are often caused by problems between online servers over which we have no control. However, sometimes, there is no real problem, but our browser believes that there is one due to a problem within it, a problem with the home network equipment, or some other reason that is under control.
It is important to mention that Microsoft IIS web servers often provide more information about the cause of a specific 502 Bad Gateway error. That is true when adding an extra digit after 502, as in HTTP error 502.3: the web server received an invalid response while it acted as a gateway or proxy, which means terrible gateway: connection error of the forwarder (ARR). Microsoft provides a list of all the response codes associated with a 502 in its official documentation.
A tip, in the case of HTTP error 502.1 – The incorrect gateway error, refers to a CGI application timeout problem and is best solved as a problem with the 504 Gateway Timeout.
How to fix the 502 Bad Gateway error
Now, how do we correct a 502 Bad Gateway error? Well, we already know that often the error corresponds to a network error between servers on the Internet, which means that the problem would not be in our computer or Internet connection.
However, since it is possible that there is some problem on our part, here are some solutions to try :
Try loading the URL again by pressing F5 or Ctrl-R on the keyboard, or by clicking on the update / reload button on the browser. While the 502 Bad Gateway error indicates a network error outside of your control, it could be extremely temporary. Retesting the page could be successful.
Another option may be to start a new browser session, closing all open browser windows and then opening a new one. After that, try to open the web page again.
It is possible that the error 502 that we are receiving is due to a problem in our computer, which occurred at some point in the course of the session we have in the browser. A simple restart of the browser program could solve the problem. So it never hurts to try!
Clearing the cache of our browser could also resolve a 502 Bad Gateway error. The outdated or damaged data that the browser is storing could be the cause of this. So let’s remove those files in cache and try again with the page. The problem will be solved if this was the cause.
Remove cookies from your browser. For reasons similar to those mentioned above with cached files, deleting stored cookies could correct a 502 error. If you prefer not to remove all your cookies, you can first try to delete only the cookies related to the site where you receive the 502 error. The best is to eliminate them all, but first, we can try the appropriate ones.
Safe or fail-safe mode
Safely start your browser. Running a browser in Safe Mode means running it with the default settings and without add-ons or extensions, including toolbars.
If the 502 Bad Gateway error no longer appears when you run your browser in Safe Mode, you will know that the cause of the problem is some extension or browser configuration. Return your browser settings to the default settings. Then selectively activate/deactivate the browser extensions to find the cause and solve the problem permanently.
The Safe mode of a browser has an idea similar to the Safe way in Windows, but it is not the same. You do not need to start Windows in Safe Mode to run any browser in its “Safe Mode.”
Try another browser. Popular browsers include Firefox, Chrome, Safari, Internet Explorer, among others. If an alternative browser does not produce a 502 Bad Gateway error, now you know that your original browser is the source of the problem. Assuming you have followed the previous troubleshooting suggestion, now would be the time to reinstall your browser and see if that corrects the problem.
Restart your computers
Restart your computer. Some temporary problems with your computer and the way they connect to the network could be causing 502 errors, especially if you see the error on more than one website. In these cases, a restart would help.
Restart your network equipment. Problems with a modem, router, switches or other network devices could be causing 502 Bad Gateway or other 502 errors. A simple reboot of these devices could help us.
The order in which you turn off these devices is not particularly critical, but be sure to turn them on again.
DNS configuration
Change your DNS servers, either on your router or your computer or device. Some Bad Gateway errors are caused by temporary problems with DNS servers.
Unless you have previously changed them, the DNS servers you have configured at this time are probably those automatically assigned by your ISP. Fortunately, there are several other DNS servers available for the use that you can choose from. You can consult different lists of public and free DNS servers, available on the Internet.
Private cases
If you have MS Forefront TMG SP1 installed and you receive the message Code Error: 502 Proxy error. The network session login failed. (1790) Or a similar message when accessing a web page. Download update 1 for Microsoft Forefront Threat Management Gateway (TMG) 2010 Service Pack 1.
Of course, this is not a standard solution for 502 proxy error messages and only applies in this particular situation. Forefront TMG 2010 is a business software package, and you will know if you have it installed.
Try to contact
Assuming you’ve tried everything, reaching the website directly could also be a good idea. The chances are that assuming they are at fault, the website administrators are already working to correct the cause of the 502 Bad Gateway error, but do not hesitate to report it.
Check the contact information page of the website for additional information. Most sites have social media accounts that they use to help their services. Some even have contacted by phone and email.
Additionally, if you suspect that a website is down for everyone, especially a popular one, checking Twitter to talk about the cut is often very useful. The best way to do this is to search for #websitedown on Twitter, such as #cnndown or #instagramdown.
On the other hand, get in touch with your Internet service provider. If your browser, computer and network work and the website report that the page or site works for them, the 502 Bad Gateway problem could be caused by a network problem from your provider.
If so, try later. At this time, the resolution of the problem is no longer in your hands. Either way, you’re not the only one who sees the 502 error, and you’ll have to wait until the problem is resolved by you.
Errors like 502 Bad Gateway
The following error messages are related to the 502 Bad Gateway error :
- Internal 500 server error
- 503 Service not Available
- 504 gateway timeout
There are also several HTTP status codes on the client side, such as the very common 404 Not Found error, among many others that can be found in lists of HTTP status code errors.
And with this, we come to an end. I hope you find all the information useful. I invite you to leave your experience in the comments. Have you had a 502 Bad Gateway error? How did you solve it?