If you want to configure your own proxy.pac file to, for example, do not modify the proxy configuration if you are in the office or later at home, we can create a new proxy.pac file and configure in the proxy setup in Internet Explorer with file://folder/with/proxy.pac, however, windows will ignore this file to avoid exactly what we are trying to achieve. See the Microsoft explanation about how Microsoft handles the Proxy configuration in https://blogs.msdn.microsoft.com/ieinternals/2013/10/11/understanding-web-proxy-configuration/
The solution goes over setting a valid URL in the Local Area Network setting of Internet Explorer, and http://127.0.0.1/proxy.pac is a valid URL.
If you d not want to use the Microsoft web system, another option is the tiny server
First, download it from:
How to use tiniweb:
We install it in c:\www\bin and create the root folder c:\www\root and log folder c:\www\log
Download also the nssm software and copy it to c:\www\bin to create our own Window sService very easily.
Install as service the tiniweb with nssm
c:\www\bin\nssm install CVSProxy –> answer we want to install as service the program c:\www\bin\tiny.exe with the following parameters c:\www\root 80 127.0.0.1
Once created:
{Optional}
Create a .bat file with the following lines and call it tini.bat, just in case we want to run it by hand
@ECHO OFF
START /B c:\www\bin\tiny.exe c:\www\root 80 127.0.0.1
{end_Optional}
Configuration in IE:
Proxy: http://127.0.0.1/proxy_mine2.pac
Uncheck automatically detect settings:
proxy_mine2.pac file:
function FindProxyForURL(url, host) {
var ip = myIpAddress();
var debug = "1";
//if(debug)
//{
// alert("DEBUG: IP=" + ip + " HOST=" + host + " URL=" + url);
//}
// If the IP address of the local machine is within a defined subnet i.e. at home send to a specific proxy.
if (isInNet(myIpAddress(), "192.168.0.0", "255.255.0.0") )
{
if(debug)
{
alert("Proxy for DIRECT " + url);
}
return "DIRECT";
}
// if we are connected to the work network
if (isInNet(myIpAddress(), "20.34.0.0", "255.255.0.0") || isInNet(myIpAddress(), "169.254.0.0", "255.255.0.0"))
{
if (
shExpMatch(host, "host.your.company.com") ||
shExpMatch(host, "anotherhost.your.company.com") ||
dnsDomainIs(host, "*.*.globalnetwork.net*")
)
{
if(debug)
{
alert("Proxy at work " + url);
}
return "PROXY proxy.at.your.company.com:8080";
}
}
}
