You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

502 bad gateway

Hi There


I keep getting 502 Bad gateway message on a site that I regularly use.Can anybody please advice me on how i can correct this please.I have tried other browsers but they are the same message.Thanks In Advance

MacBook Air 13″, macOS 10.15

Posted on Jan 20, 2022 3:54 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 21, 2022 10:35 AM

Thanks. That site loaded without complaint on several different Macs running a variety of browsers including Safari, Firefox, and Brave. Their Mac operating systems included most versions from the latest all the way back to El Capitan, which is really really old.


Nevertheless it is helpful information in that there is no reason to suspect anything wrong with the site itself — its security certificate(s) appear to be correct, and it's not demanding any unusual browser settings. All that means the following Apple Support document will bring you closer to a solution:


If Safari on Mac doesn't open a webpage or isn't working as expected - Apple Support


There are a number of links within it, so be sure to research all of them.


I suspect the problem will probably turn out to be an error in your ISP's DNS server.

15 replies
Question marked as Top-ranking reply

Jan 21, 2022 10:35 AM in response to meryl104

Thanks. That site loaded without complaint on several different Macs running a variety of browsers including Safari, Firefox, and Brave. Their Mac operating systems included most versions from the latest all the way back to El Capitan, which is really really old.


Nevertheless it is helpful information in that there is no reason to suspect anything wrong with the site itself — its security certificate(s) appear to be correct, and it's not demanding any unusual browser settings. All that means the following Apple Support document will bring you closer to a solution:


If Safari on Mac doesn't open a webpage or isn't working as expected - Apple Support


There are a number of links within it, so be sure to research all of them.


I suspect the problem will probably turn out to be an error in your ISP's DNS server.

Jan 21, 2022 2:53 PM in response to meryl104

I neglected to mention a few more simple steps you can try. In no particular order,



If you remain stuck I have more ideas.

Jan 28, 2022 11:12 AM in response to meryl104

Thanks. Try the following, to rule out some additional possibilities:


  1. Shut down your Mac.
  2. Load macOS Recovery by holding and r (two fingers) while you start your Mac with a third finger.
  3. At the Utilities screen, release those two fingers.
  4. Choose Safari (or Get Help Online, depending on the Recovery version that appears).
  5. Safari will launch, but it will lack your bookmarks, favorites, history and other preferences.


Determine if the problem persists while using Safari in that mode. After that, restart your Mac normally, and reply with your observations.

Jan 20, 2022 7:27 AM in response to meryl104

I have tried other browsers but they are the same message.


In that case, it is likely that the site's URL is malformed. The ISP you are using may have a bad DNS entry in the database it uses.


Rule out the latter by attempting to connect with an iPhone not connected to the same wireless network you are using.


If the site requires a security certificate, that may also be a factor. Ideally, the website creator should fix that problem.


At your option, post the site URL in a reply to this Discussion. Don't do that if you don't want the general public to know what it is though.

Feb 3, 2022 3:54 PM in response to KG0012

The macOS Recovery worked and launched the website using safari in that mode. But only in that mode.


That's good information. The cause is almost certainly a misconfigured DNS, but the corrective action will be different for you vs. the originator of this Discussion. While we await the outcome of Meryl's experiment (which may never come) I suggest looking into your Mac's Network Preferences.


(Apple menu) > System Preferences... > Network > select your network interface (probably Wi-Fi) > Advanced > DNS.


Under DNS Servers, what entries do you see?


Example below.



That's about as simple as it gets. Yours is almost certainly different because it will be a function of your network and your ISP, but it may provide a clue.


  • The DNS Server address of 10.0.1.1 in the above is the address of the router I was using. In turn, the router I was using will reflect the DNS Server address(es) provided by the ISP I was using. The DNS Server they use is up to them. In nearly every case, whatever DNS service your ISP chooses to use is ok, but you can change it to a different service if you prefer. Just be aware that all of them have a financial incentive to convince people to use theirs vs. someone else's. The Internet isn't free.


The Hosts deleted the problematic website you posted (the "planning portal" one) but it's not important. I saw it in the subscription email I received and there's nothing wrong with that site.

Feb 8, 2022 7:55 AM in response to KG0012

Is it selectable or "greyed-out"? If you can select it then do that and click the [—] (minus) button to remove it.


If it is not selectable then it is the IP address of the router you are using and you need to fix the problem in your router. To review what its settings ought to be, please read Recommended settings for Wi-Fi routers and access points - Apple Support. You may need to review your router's documentation also.


It can get complicated. Usually, the easiest way to resolve unknown problems involving a router is to reset it to factory defaults and configure it anew. Again, you will need to review the documentation accompanying your router or wireless access points.

Feb 3, 2022 6:10 AM in response to John Galt

Hello! I had this exact problem. A persistent “502 Bad Gateway” error for a website I regularly use and know is safe


I have followed all the above advice. The macOS Recovery worked and launched the website using safari in that mode. But only in that mode. (I tried rebooting and using Safari as normal and still got the “502 Bad Gateway” error).


Can you help?


[Link Edited by Moderator]

Feb 3, 2022 3:17 PM in response to KG0012

Hello! I had this exact problem. A persistent “502 Bad Gateway” error for a website I regularly use and know is safe.


I have followed all the above advice. The macOS Recovery worked and launched the website using safari in that mode. But only in that mode. (I tried rebooting and using Safari as normal and still got the “502 Bad Gateway” error). 


Can you help? 


502 bad gateway

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.