PDF download Download Article
Learn to resolve 502 errors so you can visit websites on your Mac computer
PDF download Download Article

Have you ever tried to visit a website on your Mac, only to encounter an error message that says “502 Bad Gateway,” “502 Proxy Error,” or something similar? This error can have many causes, from web traffic being misdirected to the wrong IP address to a problem with the web host’s firewall or too much traffic overloading the server. Whatever the cause, we’ve put together a list of things you can try to fix these pesky errors so you can get back to browsing the web.

Things You Should Know

  • Many 502 errors will resolve if you just wait a few minutes and refresh the page.
  • Try clearing your cache to get rid of outdated information about the page stored in your browser.
  • Changing to a new DNS server may help if you have persistent bad gateway errors.
1

Refresh the page.

PDF download Download Article
  1. In many cases, it is enough to simply wait a few minutes, then reload the page. Hit your browser’s Refresh button, which is located near the address bar on most browsers. Or, use the keyboard shortcut command + R.
  2. Advertisement
3

Clear your cache and cookies.

PDF download Download Article
  1. When you go to a website, your browser saves information about it to help it load faster next time you visit. This is usually helpful, but it can cause problems if the cache happens to save outdated information. Try clearing your cache, then reload the page and see if the problem persists.
    • In Safari:
      • Click the Safari menu at the top of your screen and select Settings or Preferences.
      • In the Advanced tab, check the box next to Show Develop menu in menu bar. If it’s already checked, leave it alone.
      • Open the Develop menu at the top of the screen and click Empty Caches. This will empty your caches without also deleting data like cookies or your browsing history.
      • If you want to clear cookies as well, go to Safari > Settings (or Preferences) and click the Privacy tab. Click Manage Website Data and click Remove All.
    • In Chrome:
      • Click the Chrome menu at the top of your screen and select Clear Browsing Data.
      • Check the boxes next to all the types of data you want to clear (e.g., history, cookies, cached files and images), then click Clear data. You can also select the timeframe you want to clear in the dropdown at the top.
    • In Firefox:
      • Click History in the menu bar at the top of the screen.
      • Select Clear Recent History.
      • Check off Caches, Cookies, and any other data you want to clear and click Clear Now.
  2. Advertisement
5

Reboot your Mac.

PDF download Download Article
  1. There’s a reason why “try turning it off and turning it back on” is classic IT advice. A lot of problems can be solved by restarting your computer—sometimes even less obvious ones, like a bad gateway error. To reboot your Mac, click the Apple menu at the top of the screen and select Restart. Wait for your Mac to boot back up and try visiting the website again.
  2. Advertisement
7

Change your DNS server.

PDF download Download Article
  1. If something goes wrong with your default DNS servers, it can cause connection issues such as bad gateway errors. To resolve this issue, you might need to switch to a new DNS server. Here’s how to do it on a Mac:[1]
  2. Advertisement
8

Flush your DNS cache.

PDF download Download Article
  1. If a lot of outdated information has built up in your computer’s local DNS cache, it can disrupt your ability to connect to some websites. To flush your cache:
    • Open the Launchpad in your Dock and search for Terminal. Click on the result.
    • If you’re using Monterey or later, enter the command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press return. For earlier versions of macOS, check out our guide to flushing your DNS cache.
    • Enter your administrator password when prompted and press return again.
10

Troubleshoot your website if you’re the developer.

PDF download Download Article
  1. As a website developer, there are a few things you can try to fix this issue:
    • Temporarily turn off your CDN (content delivery network) and see if the problem goes away. The correct way to do this depends on which CDN you’re using.
    • Try turning off or reconfiguring your firewall. It might be blocking traffic to your server.
    • Run a traceroute to see if your server is currently accessible.
    • Test your website for script errors that could be causing problems.
    • Contact your website’s hosting company and find out if they’re experiencing any problems.

Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!

You Might Also Like

Advertisement

About This Article

Luigi Oppido
Reviewed by:
Computer & Tech Specialist
This article was reviewed by Luigi Oppido and by wikiHow staff writer, Megaera Lorenz, PhD. Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years. This article has been viewed 6,541 times.
How helpful is this?
Co-authors: 3
Updated: January 18, 2024
Views: 6,541
Categories: Mac
Thanks to all authors for creating a page that has been read 6,541 times.

Is this article up to date?

Advertisement