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.

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.

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.

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

Five lessons learned from the pivot to a distributed workforce

Delivering continuity and scale with a remote work strategy

Download now

Connected experiences in a digital transformation

Enable businesses to meet the demands of the future

Download now

Simplify to secure

Reduce complexity by integrating your security ecosystem

Download now

Enhance the safety and security of your people, assets and operations

Enable a true vision of security with an engineered solution based on hyperconverged and storage platforms

Download now

Most Popular

Accenture ploughs $3 billion into cloud migration support group
digital transformation

Accenture ploughs $3 billion into cloud migration support group

17 Sep 2020
16 ways to speed up your laptop

16 ways to speed up your laptop

16 Sep 2020
Google Pixel 4a review: A picture-perfect package
Google Android

Google Pixel 4a review: A picture-perfect package

18 Sep 2020