What Does ‘502 Bad Gateway’ Mean? (And Can You Fix It?)






So you’re knee-deep into an internet browsing session when all of a sudden you run into a 502 bad gateway message. You hit refresh a couple of times, but the same error keeps continues to pop up. But what does this message mean, and what can you do to fix the problem?

Advertisement

The 502 bad gateway message is similar to the 504 gateway timeout error as both show up when there’s a communication issue between one server and another. However, while the 504 indicates that the second server couldn’t provide a response on time, the 502 error means the second server responded but what it sent back was invalid and can’t be used to fulfill the request you sent to the first server (like loading a web page you’re visiting). Here we’ll cover the possible causes behind this error and walk you through a few fixes you can try on your end.

Run basic checks

A 502 bad gateway error essentially tells you that something went wrong on the server’s side. The server may be overloaded with traffic, the website has a broken code causing it to crash or fail, or there’s a temporary glitch interrupting communication. While this issue is generally beyond your control, here are some basic checks you can try to regain access to a website:

Advertisement

  1. Wait a few minutes and refresh the website to see if the connection pushes through. You might be trying to load the page while it’s busy or experiencing a glitch. If you’re not in a rush to view the website, try accessing it again in a few hours or the next day to confirm if the domain owners have sorted out the problem on their end.
  2. Restart your device. Reboots are often the quick fix to most tech problems.
  3. Check whether the website is operational through the official channels of the website, communities like X and Reddit, or status monitoring platforms like Is It Down Right Now and Downdetector.
  4. Access the website on a different phone or computer to see whether the issue is with the server or your specific device.
  5. Visit different websites to determine if they’re also throwing up a 502 bad gateway error. If you get the error in multiple sites but can still access others without any hiccup, the problem might be with those websites’ Content Delivery Network (CDN) like Cloudflare or Google Cloud. In that case, reach out to the website’s customer service to report the issue, so they can properly guide you on what to do next.

If these basic checks don’t work, you can also try looking into your browser, network, and DNS settings.

Check your browser

Sometimes, the 502 bad gateway error is a result of a conflict in your browser, such as a bad extension, cached data, or cookies. To test this, try using a different browser on the same device and see whether you encounter the 502 issue. You can also open the site in Incognito mode, a new profile, or Guest mode on Chrome since they all don’t use the same extensions, cached data, and cookies as your regular profile. If the site loads fine in the alternate browser or modes, follow these next steps to troubleshoot:

Advertisement

  1. Uninstall extensions to isolate the problem that could be causing browsing issues. 
    1. In Chrome, navigate to More (three dots in the upper right corner) > Extensions > Manage Extensions and click Remove to uninstall the extension. 
    2. In Safari, head to Safari > Settings > Extensions and press Uninstall under the extension you want to delete.
  2. Clear your browser cache and cookies. If you’ve previously visited the website you’re having a problem with, the 502 bad gateway error might be due to the cached version of the site in your browser and/or the cookies the site saved on your device. 
    1. To clear the cache and cookies in Google Chrome, go to More > Delete browsing data, mark the checkbox for “Cached images and files” and “Cookies and other site data,” set the Time range to All time, and hit Delete data. 
    2. To delete the cache in Safari, navigate to Safari > Settings > Advanced, check the box for “Show features for web developers” at the bottom, and then head over to Develop (in the top menu) > Empty Caches. 
    3. To clear your cookies in Safari, click on Safari > Settings > Privacy > Manage Website Data and press Remove All.

Change your network configurations

There may be instances when your network is the culprit behind the 502 bad gateway you’re seeing on your browser. Here are several fixes you can try to troubleshoot your home network:

  1. Disconnect from your current network and use a different one like your phone’s hotspot to open the website.
  2. Restart the Wi-Fi router. Your router may be having issues properly communicating with the servers. Unplug it from the wall outlet and wait for about a minute before powering it on again.
  3. Turn off the VPN if you’re using one. It may be interrupting your direct connection to the server.
  4. Disable your proxy settings. Your computer’s proxy settings essentially asks your device to send your web requests to a proxy server instead of directly from your device.
    1. In Windows, go to Settings > Network & internet > Proxy and toggle off the option to automatically detect settings under Automatic proxy setup. Also, under Manual proxy setup, click Edit, and disable Use a proxy server.
    2. In macOS, press Apple menu > System Settings > Network > Wi-Fi > Details > Proxies and toggle off anything that’s enabled.

If all the sites you’re visiting give you a 502 bad gateway error, consider contacting your Internet Service Provider (ISP) for help as the issue might be stemming from their system.

Advertisement

Configure your DNS settings

The DNS is responsible for translating a website name to the associated IP address of the server it lives in. When your regular DNS is having issues, it might prevent you from loading the website on your end, and thus the 502 error. Here’s what you can do to troubleshoot this:

Advertisement

  1. Switch to a different DNS as a third-party one might be more reliable.
    1. To change the DNS on Windows, select Settings > Network & internet > Wi-Fi (or Ethernet) > [your network name] and press Edit next to DNS server assignment. Change it to Manual, input your preferred DNS (like 8.8.8.8 for the Google Public DNS or 1.1.1.1 for the Cloudflare DNS), and then hit Save.
    2. In macOS, go to Apple menu > System Settings > Network > Wi-Fi (or Ethernet) > Details > DNS. Then, click on the plus icon, enter your new DNS, and press OK to save it.
  2. Clear your DNS cache. The DNS cache is the data saved by your computer every time you use the DNS (a.k.a. visit websites on your browser). It’s used to reload the websites faster the next time you visit them, but it may also be producing a conflict that stops your browser from properly displaying the website.
    1. In Windows, open the Command Prompt and type ipconfig/flushdns. A success response will then be shown.
    2. In macOS, go to Terminal and input sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Type your password when prompted.

Afterward, open your browser and try visiting the website again.



Leave a Comment