IT Pro is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more

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

We explain what this networking error means for users and website owners

Out of all the browser errors that are displayed to users when they fail to properly connect to a website, the ‘Error 502 Bad Gateway’ message is among the most commonly encountered.

There is a good chance that if you have run into this error message while browsing, you’re not at fault. Typically, an Error 502 bad gateway indicates that there is an issue with the website’s server, rather than anything on your end. That means you don’t need to go and investigate your router or check if a mouse has chewed through an ethernet cable. If you’ve encountered it, then it’s likely other users trying to access the site are also seeing the same thing.

A good test to check if you’re connection is at fault is to simply visit a different website, or a few, and if you can connect to those then your connection is fine. If you visit another website that displays the same message and a third website that connects without issue, then the second website may either be experiencing similar issues, or even be running from the same infrastructure.

These types of problems rarely last any significant period of time and are easily fixed by the website’s administrators, usually. The ‘Error 502 Bad Gateway’ message has been around for a long time which means websites have become quite adept at fixing them in a timely manner.

However, if you’re feeling up to it and are curious to see if you can do something yourself, there are a number of different tactics that may work.

What causes a 502 Bad Gateway error?

Server overload: An overloaded server is one of the most common causes of a 502 error. This is where the server has reached its memory capacity, often activated by an unusually high number of visitors trying to access the same website. This can just be a coincidence, or maybe driven by a big event, but it can also be a targeted DDoS attack.

Request blocked by a firewall: With cyber criminals finding more and more ways to breach corporate networks, firewalls continue to play a key role in stopping them in their tracks. However, a number of firewalls can often go further than you’d like and inadvertently treat a massive influx of legitimate users as an attempted cyber attack. This can often occur with DDoS protection layers, which block requests from content delivery systems and cause the network to grind to a halt.

Faulty programming: Often enough, a glitch or coding error in a website's code might result in requests not being answered correctly, sparking the 502 Bad Gateway error to show up.

Related Resource

The top three IT pains of the new reality and how to solve them

Driving more resiliency with unified operations and service management

Man at his computer next to title card - whitepaper from ServiceNowFree download

Network errors: There is a multitude of potential networking errors that may occur, including potential DNS issues, routing problems, as well as issues relating to your Internet Service Provider (ISP). An ISP, for example, may have decided to block a certain web address.

Server software timeouts: The error can also show for users when a web server takes longer than expected to return a request, and the caching tool reaches its time values. Slower queries can also cause this problem.

How to fix a 502 Bad Gateway error

There are a number of key steps that users can take to attempt to fix a 502 Bad Gateway error.

  1. Refresh your browser: Refresh your browser: One of the simplest tricks that can help resolve the issue is to refresh the browser a few times. The error can sometimes be displayed as a result of a server becoming overloaded with requests - an issue that is often resolved quickly. Refreshing the browser and sending new requests to the website can help rest the connection and get your browsing back up and running again.
  2. Clear your browser cache: Every browser is different but modern browsers such as Chrome, Firefox, Safari and Microsoft Edge make it easy to find this setting, often located in the browser history section. Clearing the cache is another effective way to overcome 502 bad gateway errors so it’s worth trying, just in case.
  3. Temporarily disable your firewall: We’ll preface this by saying that a firewall should always be active and it is not recommended to disable it for any significant length of time. But in some cases, disabling it and successfully re-attempting to connect to the website may indicate a problem with the firewall’s settings, which can be usually altered through the admin console of your security provider.
  4. Check with monitoring sites: If this doesn't work, you could always turn to online services such as Down for everyone or just me? or Down detector. These monitor the web for any outages and allow users to report any problems they may be encountering. If it's an issue affecting not just you, then the chances are others will have reported it, and the more people reporting problems, the more likely it’s a prolonged issue.
  5. Use a VPN to access the site: There are various online virtual private networks (VPNs) such as Hide My Ass and others that can reroute your connection before you access the site. This means you'll be able to figure out whether any issues may have popped up with your ISP, for example, when ISPs block access to certain sites for any particular reason.
  6. Examine web server logs: If this error persists, it may require some further investigation 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

The state of Salesforce: Future of business

Three articles that look forward into the changing state of Salesforce and the future of business

Free Download

The mighty struggle to migrate SAP to the cloud may be over

A simplified and unified approach to delivering Enterprise Transformation in the cloud

Free Download

The business value of the transformative mainframe

Modernising on the mainframe

Free Download

The Total Economic Impact™ Of IBM FlashSystem

Cost savings and business benefits enabled by FlashSystem

Free Download

Most Popular

How to boot Windows 11 in Safe Mode
Microsoft Windows

How to boot Windows 11 in Safe Mode

29 Jul 2022
Samsung proposes 11 Texas semiconductor plants worth $191 billion

Samsung proposes 11 Texas semiconductor plants worth $191 billion

21 Jul 2022
Should you take your password manager off the internet?

Should you take your password manager off the internet?

28 Jul 2022