502 Bad Gateway Error Solutions

Martin Brinkmann
Apr 26, 2017
Updated • Apr 26, 2017

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

502 bad gateway error

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?

cloudflare 502 bad gateway error
source Cloudflare

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

startpage proxy 502 bad gateway

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

google cache

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:

  1. Open the Google search engine.
  2. 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 Error Solutions
Article Name
502 Bad Gateway Error Solutions
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.
Ghacks Technology News

Tutorials & Tips

Previous Post: «
Next Post: «


There are no comments on this post yet, be the first one to share your thoughts!

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.