Friday, April 8, 2016

Simple WPAD script for direct connection to anything local

Below is a simple wpad script to let users have direct connection to anything local and the rest through proxy. You can continue to add statements but remember to add the corresponding brackets and the start and end.

Explanation

isPlainHostName(host) - the destination hostname. Any plain hostname (without FQDN) will be going direct

isInNet(myIpAddress() - the source address. This may be a local network where you do not want the users to use the proxy.

isInNet(host) - the destination address. The three shown are all the private address
function FindProxyForURL(url, host)
{
if (((((isPlainHostName(host) ||
dnsDomainIs(host, ".yourlocaldomain.com") ||
isInNet(myIpAddress(), "x.x.x.x", "m.m.m.m") ||
isInNet(host, "10.0.0.0", "255.0.0.0") ||
isInNet(host, "172.16.0.0", "255.240.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0"))))))
return "DIRECT";
else return "PROXY your-proxy-server-ip:3128";
}

No comments: