Jump to content

Recommended Posts

Posted

Hi,

 

If you set the proxy settings in IE using a .pac file. Is it possible to make it so all sites go through the default gateway, but then sites listed in the file for them to go via a proxy server?

 

Bit of an odd request i know...

 

Thanks

Posted

This is my PAC file

 

function FindProxyForURL(url, host)
{
if ((host == "172.16.100.102") || (host == "172.16.127.200") || (host == "172.16.100.34")) || (host == "172.16.100.194")
return "Direct";
if (isInNet(myIpAddress(), "172.16.64.0", "255.255.255.0"))
return "PROXY 10.142.34.33:8084";
else
return "DIRECT";
}

 

basicly if i try to reach any of the IP address on the top line i'll go direct via the default gatway,

 

if (isInNet(myIpAddress(), "172.16.64.0", "255.255.255.0")) looks if im in that subnet and if so will you the proxy given, else it goes throught the Default gateway.

 

so yours should look something like

 

function FindProxyForURL(url, host)
{
if ((host == "172.16.100.102") || (host == "172.16.127.200") || (host == "172.16.100.34")) || (host == "172.16.100.194")
return "PROXY 10.142.34.33:8084";
else
return "DIRECT";

  • Thanks 1
Posted

Thanks.

 

What code would i need to put each IP address or website address on each line. It will make things a little easier when you review it you see.

Posted
just offmy head im not sure (will have to check) but i think that PAC files ignore white space so you might just be able to put a carrage return in.
Posted

Hi,

 

If you want to match specific sites (URL's) you will need to use shExpMatch to match the domain and path.

 

Just off the top of my head, a wpad.dat file to do what you ask would look like this (replace 10.0.41.15:8080 with your proxy IP and port):

 

function FindProxyForURL(url, host)
{

 // Add hostname exceptions for sites you do want to proxy
 // First line is a normal web site
 // Second line is a HTTPS or site with a different port number other than 80

 if(shExpMatch(url,"*.proxythis.com/*")) { return "PROXY 10.0.41.15:8080"; }
 if(shExpMatch(url,"*.proxythis.com:*/*")) { return "PROXY 10.0.41.15:8080"; }

 // If no matches found, use default route

 return "DIRECT";
}

 

I should also point out that in some versions of Internet Explorer the browser will try and go direct to the Internet even if you tell it not to by checking "Automatically detect network settings". The only way to force it to use the WPAD file is to firewall off port 80 and 443 unless it comes from the proxy IP, but this of course would defeat the object of what you want your WPAD file to do.

 

I am not sure if these bugs have been fixed in later versions of IE.

 

Good luck :)

  • 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...