502 Bad Gateway is a HTTP status code defined in RFC 7231 that describes a server issue as the error is thrown by the server during a connection attempt.
The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
The error message known as 502 Bad Gateway comes in many different forms as sites may customize the notification displayed to users.
Google displays 502. That's an error. for instance, and Twitter Twitter is over capacity. Most servers return at least the error code 502 however, even though the actual error message differs widely between different server types and configurations.
To name a few that you may encounter: HTTP Error 502 - Bad Gateway, 502 Proxy Error, Bad Gateway: The proxy server received an invalid response from an upstream server, 502 Server Error: The server encountered a temporary error and could not complete your request.
502 Bad Gateway
HTTP Error 502 is a server error. This means, usually at least, that the issue is not on the user's system, but on a network or Internet server. This means that the error may happen on any device using any operating system and any browser or program with Internet capabilities. Windows Update may throw the error for instance, and uses the code 0x80244021 for it.
What are the causes for 502 Bad Gateway errors?
Without going into too many details, there are a couple of common reasons why you may get the HTTP error code displayed in the program that you are using.
One is that the server that you are trying to connect to is being hammered by requests, another that a domain name may not resolve to the correct IP address, or any IP address, or simply because the server is down and not reachable at that point in time. There is also the chance that a firewall may block communication to a server, and a chance that a server's configuration is broken.
How to Fix 502 Bad Gateway errors
All of these issues are not resolvable by users who try to connect to an Internet website or service. While that is the case, there may be options to resolve the issue on the local system nevertheless.
The most likely reason, especially when you are connecting to a popular service such as Google, Twitter or Facebook, is that it is a temporary issue. Google indicates as much on the 502 error page that it displays to users.
Option 1: Reload
If you cannot connect to a service right away because of 502 Bad Gateway, all that is required to fix the issue is to wait half a minute or so before you try to connect to the site or server again.
I suggest you use CTrl-F5 to reload the page, as it will bypass the cache and instruct the browser to grab all files from the web server in question. This resolves any caching issues on the local machine as well directly.
Reloading the site or server may resolve the issue if it is a temporary one.
Option 2: Proxy, VPN or DNS server
Since the issue is caused somewhere between your device and the destination server on the Internet or a Network, it is possible that the issue is caused by your Internet Service Provider or DNS server that you are using.
If you have access to a web proxy or VPN, you may want to give it a try to see if connecting through those resolves the issue on your end.
You may use browser proxies offered by search engines such as Startpage to see if it resolves the issue:
- Open the Startpage website to get started: https://www.startpage.com/
- Paste the full URL of the site or server that you want to access in the search form, and hit Go afterwards.
- Select the "proxy" link on the search results page to open a cached copy of it in your browser.
The Opera web browser ships with a VPN which you may use to try and access the web resource.
Additionally, you may want to try using a third-party DNS server as well just to see if it may resolve the 502 Bad Gateway issue.
Option 3: Access the content using caches
While you may not be able to resolve the bad gateway error message using the fixes listed above, you may try and access the content of the site you try to visit using caches.
Please note that this works only for static content, and not dynamic one. You won't be able to use caches to sign in to services for instance, but if you try to access static content on sites, caches may help you out in this case.
You may use the Google Cache to retrieve the most recent cached copy of a page using Google:
- Open the Google search engine.
- Use cache:URL as the search term, e.g. cache:https://www.ghacks.net/
Other options that you have is to use the Wayback Machine to load cached pages of a site. It works similarly to how Google's cache works, but may present you with multiple hits for a site and not just one.
- 502 Bad Gateway (Mozilla Developer Network)
- What causes 502 Bad Gateway on a CDN (Max CDN)
- What should I do after seeing a 502 or 504 gateway error on my site? (Cloudflare)
- Stackoverflow 502 Bad Gateway posts (Stackoverflow)
- 3 Server Errors That Drain SEO
- How to Enable Flash in Chrome for Specific Websites
- How to Block Per-Site and Per-App Notifications in Google Chrome
- Local by Flywheel or Desktop Server? Can You Upgrade Between the Two
- How to fix File Download Errors on Google Chrome browser
- How to fix Aw, Snap! error message in Google Chrome browser
- Create Web Archives with Webrecorder, a free web archiving service
- How to Speed up and Optimize WordPress on a Linux VPS
- Steam Customizer: create custom Steam skins
- Fix Critical Error: Start Menu isn’t working in Windows 10