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 the 502 Bad Gateway networking error means for users and website owners, and some potential steps for fixing it

When browsing on the internet, users will see error messages from time to time. One of the most commonly encountered is ‘Error 502 Bad Gateway’, which appears when the browser fails to connect to a website.

The exact cause of the error may not be immediately apparent, and browsers generally do a poor job of conveying the exact nature of the problem. Regardless of the cause, a 502 Bad Gateway error will prevent you from accessing the target website or any pages associated with the URL.

What is a 502 Bad Gateway error?

An Error 502 Bad Gateway means there is a problem with the website’s server, rather than your computer, router, or internet connection. It’s very likely that other people visiting the same website are experiencing the same thing.

You can quickly check if there is a problem on your end by visiting a completely different website. If you can do this without any problems, then you can be assured that your connection is fine.

A 502 Bad Gateway error rarely lasts very long and is usually in the process of being solved by the site administrator by the time you see the error message. The ‘Error 502 Bad Gateway’ message has been around for many years, which means websites have become quite skilful at fixing them in a well-timed fashion.

However, if you’re feeling up to it and are curious to see if you can do something yourself, there are several 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 driven by a big event, but it can also be a targeted DDoS attack.

Related Resource

Future proofing data infrastructure with more performance, scalability, and resiliency

Dell PowerStore

Free Download

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, several 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 stop slowly.

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.

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: It sounds too simple to be true, but in some cases where the server is overloaded with requests, sending a few more requests by refreshing the browser a few times can sometimes help reset the connection between the device and server, allowing you to resume browsing.
  2. Clear your browser’s cache: If refreshing the browser a few times doesn’t work then clearing the browser’s cache may help. Major browsers will make this option easy to find within their respective settings menus and most will simply let you enter a query using a search field to find the option. The browser’s cache stores important information that can become corrupted over time, so clearing this and re-attempting to connect to the server may do the trick.
  3. Temporarily disable your firewall: Not for amateurs, this is one of the more controversial methods on this list. Firewalls should always be active since they help block malicious threats from reaching your device. But, if you’re sure the server is safe to visit, then successfully re-attempting to visit the site with the firewall disabled can indicate there is an issue with the firewall’s settings interfering with network connections. You can adjust the settings in the admin console of the firewall provider.
  4. Check with monitoring sites: There are a few free websites you can use to determine if other users are also having the same issues as you. Sites such as Down Detector monitor most major websites and provide real-time reports as to whether other users can connect or not. If using one of these sites, it’s helpful to contribute by leaving a report of your own - most don’t even require a registered account to do so. Searching the website’s name on social media platforms such as Twitter can also indicate if others are struggling too.
  5. Use a VPN: Choosing to re-route your internet traffic through a virtual private network (VPN) can be helpful in determining if your ISP is the issue with the connection to the site. Sometimes ISPs will block access to certain websites and if a VPN allows you to reach it, then it’s most likely being blocked by your provider. Contact their customer service team to remediate the problem in the long term.
  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

Threat hunting for MSPs

Are you ready to take your Managed Security Service to the next level?

Free Download

Six myths of SIEM

Things have changed when it comes to SIEM solutions

Free Download

Unified Endpoint Management and Security in a work-from-anywhere world

Management and security activities are deeply intertwined, requiring integrated workflows between IT and security teams

Free Download

The Total Economic Impact™ Of IBM FlashSystem

Cost savings and business benefits enabled by FlashSystem

Free Download

Most Popular

Windows Defender update deletes Start Menu, Taskbar, Desktop shortcuts
Microsoft Windows

Windows Defender update deletes Start Menu, Taskbar, Desktop shortcuts

13 Jan 2023
Getting your workplace transformation right for today and tomorrow
Sponsored

Getting your workplace transformation right for today and tomorrow

3 Jan 2023
Windows 11 System Restore bug preventing users from accessing apps
Microsoft Windows

Windows 11 System Restore bug preventing users from accessing apps

19 Jan 2023