Safari's proxy detection occurs through the System preferences>Network panel. If you are using multiple locations, then I suggest you set up a separate personal location for each source rather than the Automatic default setting. This will keep network preferences separate.
To establish a specific Network Location -
Go to the System Preferences>Network panel
- Location - set up a personal location by clicking on the drop down menu and selecting "add a location". Use a name familiar to you. Once established, select "apply".
- Next, click on the "Show" drop down menu and select Network Port Configurations. Only Ethernet (or Airport) ought to be checked, unless you are using a Bluetooth device. Move either Ethernet or Airport to the top of the list (you can drag it). Select "apply".
- Back to the "Show" menu, depending on your connection, select "Ethernet" or "Airport". Click on the TCP panel. There, enter these DNS server codes - 208.67.222.222 and 208.67.220.220 (separate lines) in the DNS servers box and select "apply". If your Internet Provider has specialized codes, then use those instead.
Creating a personal location, plus adding the DNS codes seems to speed things up. Otherwise, the "automatic" function has a tendency to "search" for available locations, or get caught in a unending loop of proxy searching.
Lastly, in the Finder, go to your Utilities folder and select "Terminal". Once the screen is open enter
lookupd -flushcache (copy/paste) and press return. This clears out the DNS cache. Once done, quit Terminal.