Why can’t Safari connect to that website?

It’s one of the most common problems with connected computers and devices: you point your browser at a website, and it doesn’t work. There are of course thousands of potential causes, and almost as many solutions. In this case, I’ll limit this to:

  • Safari as the browser,
  • non-mobile network connections, Wi-Fi or wired Ethernet,
  • complete failure, rather than a (possibly) more informative error message,
  • you’ve checked the website address carefully and it’s correct, or one that you use regularly,
  • there’s no apparent hardware failure, such as a dead router or disconnected cable.

If Safari returns an HTTP error code for the site, those are explained here. Most important among them are 4xx client errors and 5xx server errors, which should give you more of a clue as to what’s going wrong. Some of these get quite arcane, and one is even an April Fool’s joke about being a teapot.

Because networks and the internet present so many opportunities for failure, this guide tackles the most common problems using the most efficient approach. You can of course spend many hours, even days, analysing your network and its internet connection, but what most of us want is a timely and actionable answer.

Connect to another site

Point Safari at another site instead of the one you want to connect to. Pick a site that’s fairly simple like this one, rather than anything proprietary and complex like Facebook.

If that works fine, it demonstrates that Safari can still connect through your router to a website, just not the site that you want. The most likely cause is that the site is down: if you know the address of the site’s status page, check that next. For example, Apple’s customer-facing service status is a valuable compilation. There are several sites that give information about other popular sites, such as IsItDownRightNow?

Different browser

If others aren’t reporting that the site you’re trying to connect to is having problems, and you can connect to other sites, suspect this might be browser-specific. If you have a different browser you can try, now’s the time to copy the address from Safari and try to open it using your fallback browser.

There’s a feature in Safari that can help with this. When your browser tries to connect to a website, chances are that the server asks it to identify itself in terms of its user agent, such as Safari 16.5.2. There are times when the server may take exception to that, and decide that it’s not going to connect. This is what happened with macOS Ventura 13.4.1 RSR (a) earlier this week, when Safari declared itself with the previously unknown user agent of Safari 16.5.2 (a). Facebook and some other servers didn’t recognise that, and wouldn’t proceed with the connection.

Safari has a hidden Develop menu, enabled in the checkbox at the foot of its Advanced settings. Once that’s ticked, the second item in its new Develop menu gives you a choice of user agents that can work around this type of problem. The disadvantage of doing so is that it can lead to quirks in layout and how Safari works with sites, but that setting only affects the current tab, so you could run one as Firefox and other tabs using the default user agent if you wish.

If the site works using a different user agent, try to report the problem so that its support engineers can fix it, as was done with Facebook and other affected sites a few hours after Apple released the troublesome RSR.

All sites are down

If you can’t connect to any other sites, then there’s a breakage somewhere between your Mac and the internet. These are the worst problems, as thorough testing and tracing can take a long time. Before you even think of embarking on that, check the simplest and most obvious:

  • Has your Mac disconnected from Wi-Fi? If so, open Wi-Fi settings and try to fix them, perhaps by turning it back on if it has become turned off.
  • Has your Mac disconnected from a wired network? Are the cables all securely connected to the right ports?
  • Is your router up and running, or has it lost its connection to the internet? Does it need to be reset or restarted?

If there’s nothing obvious, close your apps and restart your Mac. In most cases a simple restart will restore full connectivity without any further action.

Network diagnosis

macOS used to have two good tools for diagnosing network connection problems: Wireless Diagnostics for Wi-Fi, and Network Utility for all connections. Bizarrely, and in the face of protest, it has dropped Network Utility. Instead, use Bryan Christianson’s wonderful WhatRoute, which is also a great improvement and explained here. Even Wireless Diagnostics is buried away in /System/Library/CoreServices/Applications to discourage its use.

Set Service Order

Now that many Macs have both wired and wireless connections, few of us pay much attention to the Service Order they are placed in. Indeed, in the new Network settings this important control has been relegated to a popup menu that was only added as a hasty afterthought following widespread complaints about the loss of network locations.

We tend to assume that, if macOS can’t connect to a site via the first method, it will automatically try others in the order that they’re set, until it has no further connections available. That assumption turns out to be incorrect, at least as of Ventura 13.4.1.

You can configure or misconfigure different network connections to access different networks. Recently I was testing a NAS on a local wired connection (back to back), while that Mac’s Wi-Fi was left connecting to my router on a separate network. When Ethernet was first in the Service Order, Safari was unable to connect to the router, and returned errors for all sites. When Wi-Fi was first instead, Safari was able to connect normally, and the NAS could be accessed fully over the wired connection.

What’s potentially misleading about this situation is that both Ethernet and Wi-Fi services showed green lights and were connected. The solution is to correct this using Set Service Order in the popup menu at the foot of Network settings, so helpfully named with an ellipsis … so that it’s easily overlooked.