1

Similar to this post, I'd like to change my proxy settings using a script. However, it fails. When I am behind the proxy, IE does not connect to the internet. Here I try the first solution from craig:

function FindProxyForURL(url, host) 
{ 
 if (isInNet(myIpAddress(), "myactualip", "myactualsubnetip")) 
  return "PROXY proxyasshowninpicture:portihavetouseforthisproxy_see_picture"; 
 else 
  return "DIRECT"; 
}

This script is saved as proxy.pac in c:\windows and my configuration is* in LAN settings: No automatically detected settings, yes, use automatic config script: file://c:/windows/proxy.pac No proxy server.

So, what am I doing wrong?

---------------- update --------------

However, when I set up a proxy in my LAN configurations:

IE -> Internet Options -> Connections -> LAN Settings 
check: Use a proxy Server for your LAN
Address: <a pingable proxy> Port: <portnr>

everything is fine for this environment. Now I try a simpler script like

function FindProxyForURL(url, host)
{
    return "PROXY <pingable proxy>:<portnr>; DIRECT";
}

With a configuration described above** I am not able to get through the proxy.

Stefan Bollmann
  • 129
  • 1
  • 7
  • Are you sure myIpAddress() is returning what you think it is? In my experience it acts very buggy on systems with more than one network interface. For example it miss-reports the address sometimes on laptops with a wired and wireless connection. – Zoredache Aug 14 '14 at 16:44
  • @Zoredache I will test it. Do you have a better idea? – Stefan Bollmann Aug 15 '14 at 08:05
  • @Zodredace: I added a test without myIpAddress(). However, the script does not do what it is supposed to do. However, I also do not know how to test this behaviour. – Stefan Bollmann Aug 20 '14 at 07:32

1 Answers1

1

Finally this page lead me to my solution:

file://-based proxy scripts are deprecated in IE11. 

There are some temporary registry hacks given, but I was not able to get my scripts to work with regedits. Finally I set up a local IIS server

Windows Start - "Control Panel." - click "Programs" link - "Turn Windows Features On or Off." 
Check the box labeled "Internet Information Services." Click "OK."

and moved my *.pac javascript file with the content

function FindProxyForURL(url, host)
{
    return "PROXY <proxyIP>:<proxyPort>; DIRECT";
}

into inetpub\wwwroot.

Afterwards I checked "Use automatic configuration script" in IE -> Internet Options -> Connections -> LAN Settings. Use the \inetpub\wwwroot\scriptFilename.

Stefan Bollmann
  • 129
  • 1
  • 7