Most browsers today support a proxy configuration script. That's just a bit of javascript that takes the DNS name/IP as arguments, and returns a string to indicate which proxy to use.
http://en.wikipedia.org/wiki/Proxy_auto-config
Fairly simple even if you don't know javascript. And all you have to do is point your browser's "automatic proxy configuration script" setting at the file. Some browsers insist the script should be on the network somewhere.
There are small programs to host files from your own machine, such as http://tinyserver.sourceforge.net/
But I usually just put it on some local webserver I have handy.
Example autoconf.js:
function FindProxyForURL(url, host) {
// our local URLs from the domains below example.com don't need a proxy:
if (shExpMatch(host, "*.example.com"))
{
return "DIRECT";
}
// URLs within this network are accessed through
// port 8080 on fastproxy.example.com:
if (isInNet(host, "10.0.0.0", "255.255.248.0"))
{
return "PROXY fastproxy.example.com:8080";
}
// All other requests go through port 8080 of proxy.example.com.
// should that fail to respond, go directly to the WWW:
return "PROXY proxy.example.com:8080; DIRECT";
}
That last bit is of particular importance, as it allows your system to attempt the proxy and then fall back to none.
There's also a variable myIpAddress
, that can be used, as below:
function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(), "192.168.1.0", "255.255.255.0"))
return "PROXY 192.168.1.1:8080";
else
return "DIRECT";
}
Though some browsers/systems get confused on that point, and may return 127.0.0.1
Best Answer
configured a loopback proxy using ccproxy link. Thanks...