Jump to content

Recommended Posts

Posted

Give this a go:

 

function FindProxyForURL(url, host) {

   // Execptions for direct connection
   if (shExpMatch(url, "*google.com*")
       shExpMatch(url, "*example2.com*"))
       return "DIRECT";

   // Proxy if PC is on local LAN
   if (isInNet(myIpAddress(), "172.16.96.0", "255.255.252.0"))
       return "PROXY 172.16.96.52:8080";

   else if (isInNet(myIpAddress(), "172.16.16.0", "255.255.252.0"))
       return "PROXY 172.16.16.30:8080";

   // Everything else to go direct
   else
       return "DIRECT";
}

Posted

FN-GM I have not tried it on a webserver as I want to put the PAC file locally onto some laptops - it's supposed to work as a local file.

 

Steve - Thanks for your script but it didn't work even on Firefox or Opera (after changing the IP to suit) - but if I put my original code back into the PAC file it works in Firefox and Opera - it's just IE8 that I'm having a problem with.

 

Note: I understand that IE caches some of this information so between tests I'm running CCleaner.

Posted

How are you specifying the location of the .pac file in IE8? Your script works for me if I give the address of the file as

 

file://

 

 

See attached screenshot

 

FN-GM I have not tried it on a webserver as I want to put the PAC file locally onto some laptops - it's supposed to work as a local file.

 

Steve - Thanks for your script but it didn't work even on Firefox or Opera (after changing the IP to suit) - but if I put my original code back into the PAC file it works in Firefox and Opera - it's just IE8 that I'm having a problem with.

 

Note: I understand that IE caches some of this information so between tests I'm running CCleaner.

proxy.png

Posted (edited)

Hi,

I have wanted to use a .pac file for all the schools we support, the thing is, we have inherited a set of schools with 192.168. address sets.

 

This is what everyone seems to have at home too so basing the pac on isInNet(myIpAddress() is a bit of a non-starter.

 

Is there any way I can use some other part of the DCHP provided config?

 

Like the DNS server address or default gateway maybe?

 

TIA

 

BoX

Edited by box_l
spelling
Posted
Hi,

I have wanted to use a .pac file for all the schools we support, the thing is, we have inherited a set of schools with 192.168. address sets.

 

This is what everyone seems to have at home too so basing the pac on isInNet(myIpAddress() is a bit of a non-starter.

 

Is there any way I can use some other part of the DCHP provided config?

 

Like the DNS server address or default gateway maybe?

 

TIA

 

BoX

 

rename (or link) the proxy.pac file to wpad.dat then make a dns entry for "wpad" with the ip address of the webserver.

set the browser to 'autodiscovery' at which point it will look for http://wpad/wpad.dat - if it fails it should go direct, otherwise will use the proxy.pac file settings.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...