How to Fix Safari The Network Connection Was Lost Error on Mac

While browsing the web on macOS, Apple Safari users frequently run into an interruption screen stating: Safari Can’t Open the Page: The network connection was lost (WebKit error code NSURLErrorDomain: -1005). Unlike standard DNS lookup errors, this specific dialogue indicates that Safari successfully initiated an HTTP/HTTPS handshake with the remote web server, but the underlying TCP/IP socket connection was abruptly terminated or timed out before the webpage payload could be fully transferred.

What Causes “The network connection was lost” in macOS Safari?

This error reflects early socket drops within the Apple WebKit networking stack. Key triggers include:

  • iCloud Private Relay Connection Drops: Apple’s dual-hop encryption relay stalling or experiencing packet routing delays through regional edge nodes.
  • Stuck HTTP/3 (QUIC) Transport Sockets: Experimental UDP-based HTTP/3 handshakes failing when passing through stateful Wi-Fi firewalls.
  • Corrupted Safari Network and Cookie Cache: Stale TLS session tickets or corrupted HSTS records preventing handshake completions.
  • Third-Party Security Software or VPNs: Endpoint packet inspectors terminating keep-alive connections prematurely.
  • MTU (Maximum Transmission Unit) Size Mismatches: Fragmented network packets being discarded by domestic routers.

Method 1: Temporarily Disable iCloud Private Relay

iCloud Private Relay routes Safari web traffic through two encrypted relays, which can trigger socket disconnects if regional egress proxies drop packets.

  1. Open the Apple menu > System Settings.
  2. Click your Apple Account name at the top of the sidebar.
  3. Select iCloud > Private Relay.
  4. Toggle the switch Off (choose Turn Off Until Tomorrow or Turn Off Private Relay).
  5. Return to Safari, refresh the page (Cmd + R), and observe whether the webpage loads cleanly.

Method 2: Clear Safari Cache and Web Site Data

Flushing cached session credentials and temporary site assets forces WebKit to negotiate fresh network sockets.

  1. Open Safari, click Safari in the top menu bar, and select Settings (or press Cmd + ,).
  2. Click the Privacy tab, then click the Manage Website Data button.
  3. Click Remove All, then confirm by clicking Remove Now.
  4. Next, click the Advanced tab and check the box at the very bottom: Show features for web developers (or Show Develop menu in menu bar).
  5. In the top menu bar, click Develop > Empty Caches.
  6. Quit Safari completely (Cmd + Q) and relaunch the browser.

Method 3: Disable Advanced Tracking and Fingerprinting Protection

Aggressive WebKit privacy filters can strip essential session headers required by dynamic websites.

  1. In Safari > Settings, click the Advanced tab.
  2. Locate Use advanced tracking and fingerprinting protection.
  3. Change the setting from in all browsing to in private browsing (or temporarily uncheck it).
  4. Reload the problematic website to see if connection integrity is restored.

Method 4: Toggle HTTP/3 (QUIC) in Safari Feature Flags

Certain network routers fail to handle UDP-based HTTP/3 traffic reliably, leading to abrupt socket closures.

  1. In Safari, click Develop in the top menu bar.
  2. Hover over Feature Flags (or Experimental Features in earlier macOS releases).
  3. Search for HTTP/3.
  4. Uncheck HTTP/3 to force Safari to fall back to proven, stable HTTP/2 over standard TCP.
  5. Relaunch Safari and test page loading.

Method 5: Flush DNS and Reset Network Interfaces via Terminal

Resetting the macOS network stack resolves corrupted mDNS responder caches.

  1. Open Terminal (via Spotlight or Applications > Utilities).
  2. Execute the following combined cache flush command:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Type your Mac administrator password and press Enter.
  4. Test loading the webpage in Safari.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.