Safari and App Store not loading
This happened for me on 10.12.5 and I kept getting the “cannot connect” message no matter what I tried. The issue for me was that I recently had downloaded and started using a proxy server (Socksharex), and it changed my network setting connection preferences; it kept trying to access the proxy server, even after I had realized that I didn’t want the proxy server and deleted it and its app. This is how I fixed it:
>System Preferences
>Network
>Advanced (bottom right corner)
>Select the “Proxies” tab
>Check “Auto Proxy Discovery” and uncheck “SOCKS Proxy.”
Problem solved
MacBook Pro 13", macOS 10.13