What is a 502 bad gateway and how do you fix it?

What does this networking error mean for users and website owners?

Among the most challenging errors to encounter while trying to access a website is the HTTP 502 bad gateway error, alongside a host of others including the 503, 504 and 500 errors. These codes refer to problems that may be occurring at the server-side of a connection, but the messages can be vague and unhelpful when encountered.

Advertisement - Article continues below

One of the most common error is the 502 bad gateway which, thankfully, isn’t ever caused by users’ equipment or internet connection experiencing a failure. The downside to this, however, is that it’s a little more tricky to overcome.

The HTTP Status Error suggests to web administrators that something has been configured incorrectly on the server. There are various potential causes, though, which means the trouble-shooting process can be arduous. The most straightforward assumption to make, however, is that there’s a communication problem between a gateway or proxy server, and the upstream or origin server.

We’ve compiled a list of some of the most common reasons that we encounter 502 bad gateway errors, and how these can be fixed.

Causes of a 502 Bad Gateway error

Server overload: An error may appear if the website's server has exceeded its operational memory capacity and has overloaded, which is normally associated with an unexpectedly high number of visitors trying to connect to the site - such as a DDoS attack.

Advertisement
Advertisement - Article continues below
Advertisement - Article continues below

Request blocked by a firewall: Firewalls are an essential part of any cyber security policy, however, they can be overzealous determining whether server communication is malicious. This is often a problem with DDoS protection systems, which can block server requests from a content delivery system and cause the network to grind to a halt.

Server overload: A server can crash if it has exhausted its memory, due to a multitude of visitors on site or a DDOS attack.

Firewall blocks a request: A firewall may block communications between an edge server and upstream server. Some DDoS protection systems can over-react and block requests from a content delivery system.

Faulty programming: Sometimes an error in a website's code may mean that requests cannot be answered correctly, prompting this error to show up.

Network errors: DNS issues, routing problems, and ISP related issues can also lead to a 502 Bad Gateway error.

Advertisement - Article continues below

Server software timeouts: This error can also occur when a web server takes more time to complete and a caching tool reaches its timeout values that time. Slow queries can also cause this problem too.

How to fix a 502 Bad Gateway error

Often enough these errors may go away by themselves by refreshing a web page a few minutes later. The problem that caused the error message to operate was probably a temporarily overloaded server - if that’s what happens. 

Using an online service such as Down for everyone or just me? or Down detector may often reveal whether the problem is being experienced by more people. Third-party proxies, such as Hide My Ass, meanwhile, may solve the problem if it’s an issue with a particular Internet Service Provider (ISP), for example, if an ISP has blocked access to the site you’re trying to reach, for any reason.

If this error happens regularly, it may require some further investigation in order to find a solution. Examining web server logs at the time of the error occurring will be a good place to start. If you are the owner of the website, you can check your FQDN (fully qualified domain name) is correctly resolving. You can also check a server is reachable via a ping text or traceroute.

Featured Resources

Preparing for long-term remote working after COVID-19

Learn how to safely and securely enable your remote workforce

Download now

Cloud vs on-premise storage: What’s right for you?

Key considerations driving document storage decisions for businesses

Download now

Staying ahead of the game in the world of data

Create successful marketing campaigns by understanding your customers better

Download now

Transforming productivity

Solutions that facilitate work at full speed

Download now
Advertisement
Advertisement

Most Popular

Visit/mobile/google-android/356373/over-2-dozen-additional-android-apps-found-stealing-user-data
Google Android

Over two dozen Android apps found stealing user data

7 Jul 2020
Visit/laptops/29190/how-to-find-ram-speed-size-and-type
Laptops

How to find RAM speed, size and type

24 Jun 2020
Visit/cloud/356260/the-road-to-recovery
Sponsored

The road to recovery

30 Jun 2020