Jump to content

Recommended Posts

Posted

function FindProxyForURL(url, host)

{

//Declare proxy strings as variables
var studentproxy = "PROXY MrSquid.domain.com:3128";

// IP not to use proxy
if (shExpMatch(url, "http://10.*")) { return "DIRECT"; }
if (shExpMatch(url, "http://127.0.0.1*")) { return "DIRECT"; }
if (isPlainHostName(host)) { return "DIRECT"; }

// URLS not to use proxy server
if (shExpMatch(url, "*schoolhomepage.com*")) { return "DIRECT"; }
if (shExpMatch(url, "*someotherservice.net*")) { return "DIRECT"; }

// Apply proxy if machine is on internal network
if (isInNet(myIpAddress(), "10.0.0.0", "255.0.0.0")) { return studentproxy; }
if (isInNet(myIpAddress(), "10.0.0.0", "/8")) { return studentproxy; }

else

return "DIRECT";

}

 

The two lines under the 'apply proxy' section was a fix I had to do because Internet Explorer and Firefox read subnets differently, or something like that. It was a long time ago and it still works.

 

I forget who I got the above from, but it was from a member here.

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