function FindProxyForURL(url, host) {
// If IP address is internal or hostname resolves to internal IP, send direct.
var resolved_ip = dnsResolve(host);
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
isInNet(resolved_ip, "127.0.0.0", "255.255.255.0"))
return "DIRECT";
// Use a different proxy for each protocol.
if (shExpMatch(url, "http:*")) return "PROXY proxy1.domain.com:3128";
if (shExpMatch(url, "https:*")) return "PROXY proxy2.domain.com:3128";
if (shExpMatch(url, "ftp:*")) return "PROXY proxy3.domain.com:3128";
}
all.js
pref("network.proxy.type", "0");
pref("network.proxy.ftp", "proxy");
pref("network.proxy.ftp_port", 3128);
pref("network.proxy.http", "proxy");
pref("network.proxy.http_port", 3128);
pref("network.proxy.ssl", "proxy");
pref("network.proxy.ssl_port", 3128);
pref("network.proxy.type", 1);
pref("network.proxy.type", "0"); where 0 = direct, 1 = manual, 2 = PAC, 3 -> mapped to 0, 4 = Auto-detect proxy settings for this network. Only this line needs to be updated to configure for autodetect.
Web Proxy Auto Detect (WPAD) - For Internet Explorer,
Or edit the registry with a logon script:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d "192.168.168.5:3128" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOveride /t REG_SZ /d "<local>" /f
You can also create an registy file and import it using regedit in the logon script with "Regedit /s z:\public\setproxy.reg" where z:\public\setproxy.reg is the correct path for your network. The registry file can be created in notepad and should contain the following:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyServer"="192.168.168.5:3128" "ProxyEnable"=dword:00000001 "ProxyOverride"="<local>"
Where 192.168.168.5:3128 is the actual IP adress and port number of your proxy server.
Create a wpad CNAME for an internal webserver. This is the default location that most browsers when set to "autodetect" will go.
function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(), "192.168.168.0", "255.255.255.0"))
return "PROXY 192.168.168.5:3128";
else
return "DIRECT";
}
You'll have to add the MIME type for the wpad.dat file
On IIS: Internet Information Services > Expand until you get to the domain name. right-click on the domain name and select Properties > HTTP Headers > MIME Types > New
Extension: .dat
MIME type: application/x-ns-proxy-autoconfig
On Apache: Create a .htacces file in the same directory as the wpad.dat file that reads:
AddType application/x-ns-proxy-autoconfig .dat
Name: WPAD
Data Type: String > OK
Code: 252
String: http://wpad.company.com/wpad.dat - "wpad.dat" must be lowercase. Should the "http://" be there?
Right click on Server Options > Configure Options. Confirm that Option 252 is checked.