How to automatically disable/enable your proxy settings

Tired of turning off your proxy settings when outside the office? Well, yea, me too. For a long time now there’s a simple and effective way to do this by using a PAC file or Proxy Automatic Configuration file. This PAC file is a simple text document stored inside your computer and is referred by your browser before connecting to the internet.

The PAC uses javascript language to simply do a IF and THEN and ELSE condition. Here’s the script of my file i am using, its named proxy.pac

—code start:don’t copy this line—

function FindProxyForURL(url, host)
{ if (isInNet(myIpAddress(), “”, “”))
return “PROXY”;
return “DIRECT”;

—code end:don’t copy this line—

Now, create a file, say, proxy.pac using notepad.exe, copy the above code into the file you just created, then save it.

Next, you will have to “tell” your browser to use this auto configuraiton file. Here’s how.

For Internet Explorer Only (will update how-to in Firefox soon, doesn’t seem to work with it)
Go to Tools >> Interent Options >> Connections Click on LAN Connections, check the box, “Use automatic configuration script”, then place this line into the empty box therein.


The above is true provided you are accessing this file from a local PC, you could also place this file into a server etc (web server).

Say OK several times to close the configuration screen. Now reload your Internet Explorer. So, if you are in your corporate network (mine is it will use your corporate proxy (mine is

So, here are the variables you MUST change to correspond to your own network:

Network: (change to your network)
Subnet Mask: 255.255.o.0 (change to your subnet)
Proxy: (change to your proxy IP or name like the example here, after the colon is the port of your proxy server, if it is port 80, you do not need to specify the colon or the port number)

The proxy.pac file can be a real huge monster to do things like high availability for proxy server, support multiple Networks (my example only support 1 network).

More information can be found at:


  1. have you confirmed your pac file working under ie7.

    I am having problems with ie7

Comments are closed.