The error message “Safari can’t connect to the server” (accompanied by error code NSPOSIXErrorDomain:57 or kCFErrorDomainCFNetwork:302) appears in Apple Safari on macOS, iOS, and iPadOS when the web browser successfully parses a web address but fails to establish a low-level network socket connection with the remote server. Unlike SSL handshake failures (which occur after the socket is established), this error means Safari cannot complete the initial connection due to corrupted local DNS caches, rogue proxy profiles, aggressive third-party firewall filters, or IPv6 routing glitches. Resolving this issue involves flushing system DNS caches, configuring public DNS resolvers, and clearing browser network preferences.
Understanding Why Safari Fails to Connect to Web Servers
When you enter a URL into Safari, WebKit coordinates with Apple’s mDNSResponder daemon to resolve the domain into an IP address before establishing a TCP socket handshake. If the designated DNS server fails to respond, returns a defunct IP address, or routes requests through an invalid local proxy server, Safari immediately halts page execution and displays Safari can't connect to the server.
The primary origins of this error include:
- Corrupted Local DNS Resolver Cache: Stale domain lookup records in macOS or iOS pointing to decommissioned or incorrect server IP addresses.
- Unintended Proxy Server Configurations: Leftover proxy entries from discontinued VPN apps or corporate profiles forcing Safari to route traffic through non-existent endpoints.
- Third-Party Content Blocker and Antivirus Collisions: Aggressive network filters or ad-blocking extensions dropping TCP connections. For related cryptographic connection drops, see our guide on fixing Safari could not establish a secure connection.
- IPv6 Protocol Timeouts: Network routers advertising IPv6 routes that drop external WAN packets while IPv4 remains operational. (Check our guide on fixing Safari cannot open the page because the address is invalid).
| Layer | Operational Role | Common Failure State |
|---|---|---|
| mDNSResponder / DNS | Translates domain name into numerical IP | Stale cached record or ISP DNS server timeout |
| System Proxy Settings | Routes outbound traffic through middlebox | Orphaned proxy IP from removed VPN software |
| Safari Web Content Filter | Evaluates extensions and content rules | Extension strips essential routing parameters |
| TCP/IP Network Stack | Maintains socket connections to web hosts | IPv6 timeout halts dual-stack handshake |
Step 1: Check Internet Connectivity Across Other Applications
Before modifying browser configurations, isolate whether the issue is unique to Safari or affects the entire operating system:
- Open an alternative web browser (such as Google Chrome, Firefox, or Brave) or launch an app requiring internet access (such as the App Store or Weather).
- If all applications fail to load data, the issue resides with your Wi-Fi router or ISP connection. Restart your Wi-Fi router.
- If other browsers and apps load websites perfectly while Safari exclusively fails, proceed with the Safari-specific fixes below.
Step 2: Flush the DNS Cache in macOS Terminal
Flushing the macOS DNS cache forces the system daemon to discard stale IP addresses and query authoritative nameservers afresh.
- Open Terminal via Spotlight (press Cmd + Space, type
Terminal, and press Return). - Execute the official DNS flush command:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Enter your Mac administrator password when prompted and press Return.
- Restart Safari and attempt to load the webpage again.
Step 3: Audit and Disable Proxy Configurations on Mac
VPN clients and network testing utilities often leave hidden proxy settings active within macOS network interfaces.
- Click the Apple menu and select System Settings.
- Click Wi-Fi (or Network) in the sidebar.
- Click the Details… button next to your active network connection.
- Select Proxies from the left-hand menu.
- Ensure that all proxy protocols (including Auto Proxy Discovery, Web Proxy (HTTP), and Secure Web Proxy (HTTPS)) are toggled Off.
- Click OK and Apply.
Step 4: Configure Public DNS Servers (1.1.1.1 / 8.8.8.8)
ISP-provided DNS servers frequently experience localized outages. Switching to trusted public DNS providers resolves routing stalls.
On macOS
- In System Settings > Wi-Fi > Details > DNS.
- Under the DNS Servers box, click the + button.
- Add Cloudflare DNS:
1.1.1.1and1.0.0.1. - Add Google DNS:
8.8.8.8and8.8.4.4. - Click OK, then restart Safari.
On iPhone and iPad
- Open Settings and tap Wi-Fi.
- Tap the blue (i) info icon next to your connected Wi-Fi network.
- Scroll down and tap Configure DNS.
- Change from Automatic to Manual.
- Tap Add Server, enter
1.1.1.1, and tap Save.
Step 5: Disable Safari Extensions and Clear Website Data
Corrupted site cookies or ad-blocking extensions can disrupt Safari’s internal connection pipelines.
- In Safari, go to Safari > Settings > Extensions.
- Untick all active third-party extensions to disable them temporarily.
- Navigate to the Privacy tab and click Manage Website Data….
- Click Remove All to clear cached scripts and cookies.
- Restart Safari and test loading the site.