RSS

if else in proxy.pac

22 Sep

function FindProxyForURL(url, host)

{

//Set a default proxy if non are returned below

var proxy = "PROXY 192.168.0.244:8080";

// Test for Prestons subnets

if (isInNet(myIpAddress(), "192.168.1.0", "255.255.255.0"))

proxy = "PROXY proxy_preston:8080";

if (isInNet(myIpAddress(), "192.168.2.0", "255.255.255.0"))

proxy = "PROXY proxy_preston:8080";

// Test for Londons subnets

if (isInNet(myIpAddress(), "192.168.3.0", "255.255.255.0"))

proxy = "PROXY proxy_blackpool:8080";

if (isInNet(myIpAddress(), "192.168.4.0", "255.255.255.0"))

proxy = "PROXY proxy_blackpool:8080";

//Now direct the user out through the proxy if not internal site

if (isInNet(host, "192.168.0.0", "255.255.0.0"))

{

return "DIRECT";

}

else if (url.substring(0, 24) == "http://www.microsoft.com")

{

return "PROXY 159.180.13.52:3128";

}

else if (url.substring(0, 5) == "http:")

{

return proxy;

}

else if (url.substring(0, 4) == "ftp:")

{

return proxy;

}

}

Advertisements
 
Leave a comment

Posted by on September 22, 2010 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: