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

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

502 Bad Gateway page that pops up when a website has a connection issue with its server

There are a number of problems one can come across when searching the web and some of the most challenging issues have their own special code. For instance, if there is a bad gateway it is referred to as a HTTP 502 error. 

Other website errors include 503, 504 and 500 and they occur at the server-side of a connection. 502 is the most common of these and it is hardly ever caused by a user's computer or Wi-Fi connection.  Instead, the HTTP status error suggests that something has been incorrectly configured on the server.

This can be due to a number of various reasons and can be a little tricky to fix. However, one of the most common causes is a communication problem between a gateway and or the proxy server and the upstream or original server. 

But that isn't always the case and you may want to read on to see what other issues cause a HTTP 502 bad gateway error. 

Causes of a 502 Bad Gateway error

Server overload: This is an error that will appear if the website's server has exceeded its operational memory capacity. This will cause an overload which normally is associated with higher than expected visitors trying to visit the site. This can also be malicious, such as a DDoS attack.

Request blocked by a firewall: Although firewalls are necessary, particularly as cyber attacks are becoming more and more common for businesses, they can be a little overzealous and often mistake mass users coming to a webpage as a hack. 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

Digital document processes in 2020: A spotlight on Western Europe

The shift from best practice to business necessity

Download now

Four security considerations for cloud migration

The good, the bad, and the ugly of cloud computing

Download now

VR leads the way in manufacturing

How VR is digitally transforming our world

Download now

Deeper than digital

Top-performing modern enterprises show why more perfect software is fundamental to success

Download now

Most Popular

IT services giant Sopra Steria falls victim to Ryuk ransomware
Security

IT services giant Sopra Steria falls victim to Ryuk ransomware

23 Oct 2020
Microsoft makes CRM a "priority" in bid to challenge Salesforce
Business strategy

Microsoft makes CRM a "priority" in bid to challenge Salesforce

21 Oct 2020
What is Neuralink?
Technology

What is Neuralink?

24 Oct 2020