What is 502 bad gateway and how do you fix it?
We explain what is 502 Bad Gateway and what it means for users and website owners, and some potential steps for fixing it

Many browsing the web might wonder what is 502 Bad Gateway after encountering the error message while browsing the web. This is a frustrating message to encounter because it's often not immediately clear what the reason is.
This commonly occurs when a browser fails to connect to a website's server, and can be a particular pain to navigate as it renders the website temporarily inaccessible.
What is 502 Bad Gateway?
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 skillful 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.

Future proofing data infrastructure with more performance, scalability, and resiliency
Dell PowerStore
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.
How long does it take to fix a 502 Bad Gateway error?
Depending on the route cause for your 502 Bad Gateway error, it can take some time to resolve the issue. Many of the solutions such as a quick refresh of the browser, clearing of the cache, or turning on or off of a firewall or VPN can be done within minutes of the error message being displayed.
If you’re the owner of a website and have recently migrated your domain from one host to another, this can lead to a 502 Bad Gateway error. In this case it could take 24-48 hours for the error to be fixed.
Other causes for a 502 Bad Gateway error include faulty network equipment on your end, which could be resolved quickly or require total overhaul of hardware. It’s impossible to attach a specific time frame to what could be a broad range of issues with equipment.
ITPro Newsletter
A daily dose of IT news, reviews, features and insights, straight to your inbox!
Rene Millman is a freelance writer and broadcaster who covers cybersecurity, AI, IoT, and the cloud. He also works as a contributing analyst at GigaOm and has previously worked as an analyst for Gartner covering the infrastructure market. He has made numerous television appearances to give his views and expertise on technology trends and companies that affect and shape our lives. You can follow Rene Millman on Twitter.
Most Popular
Resources
A daily dose of IT news, reviews, features and insights, straight to your inbox!
Thank you for signing up to ITPro. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.



