Proxy bypass when not connected to network

Soldato
Joined
17 Oct 2002
Posts
3,941
Location
West Midlands
Greetings, it's been awhile since i worked with proxy servers, is there a setting in both IE and Firefox that will let you bypass a proxy server when not connected to the company LAN?

Only reason is that when users are not connected internally or via a vpn connection from a remote location they can still get onto the internet using either browser, i have a sneaking suspision that it requires using automatic configuration scripts?
 
You can use a PAC file to do this. Something along the lines of the following should do the trick. Just distribute with a GPO and lock down users so they can't change its settings :)

Code:
function FindProxyForURL(url, host)
{
// variable strings to return
var proxy_yes = "PROXY 192.168.1.1:8080";
var proxy_no = "DIRECT";
if (shExpMatch(url, "http://www.mycompanywebsite.com*")) { return proxy_no; }
if (shExpMatch(url, "http://www.myotherwebsite.com*")) { return proxy_no; }
if (shExpMatch(url, "http://www.my3rdlocalsite.com*")) { return proxy_no; }
if (shExpMatch(url, "http://192.168.1.100*")) { return proxy_no; }
// Proxy if PC is on local LAN
if (isInNet(myIpAddress(), "192.168.1.0", "255.255.255.0"))
return "PROXY 192.168.1.1:8080";
else
return "DIRECT";
}

You can replace the urls with any addresses that you find don't work through your proxy (if you have any) and just obviously change the isInNet() to match whatever your local net addresses are.

Unfortunately it wont work properly if the laptop moves to a different network that happens to have the same address range as yourself.

Cheers for the reply, ive put together a basic one for our network, the first two entries are so that users can directly access a web chat tool attatched to our website and access the website direct without going via the proxy, the second statement covers our internal LAN and the final statement is everything else.

Does this seem valid to you?


Code:
    function FindProxyForURL(url, host)
    {
    if (isInNet(host, "189.***.***.224", "255.255.255.240") ||
    if (shExpMatch(url, "http://www.companywebsite.co.uk*"))
    return "DIRECT";
	else
    if (isInNet(myIpAddress(), "172.29.0.0", "255.255.0.0"))
    return "PROXY it-bir-prx";
    	else
    return "DIRECT";
    }
 
Back
Top Bottom