Jump to content

Recommended Posts

Posted
I want to create a pac file that will set the proxy when inside the network. I would like to say if DC is resolvable use the proxy. Can this be done?
Posted

You can do it via ip ranges or host really.

 

Doing something like isResolvable("MyDC") and if it resolves it'll apply, I mean there's always the chance that another site might use the same names though :p unless they're really unique but guessing most won't have a problem

 

Steve

Posted
I want to create a pac file that will set the proxy when inside the network. I would like to say if DC is resolvable use the proxy. Can this be done?

 

Don't know about that, but you could use IsInNet. Here's one of my old ones with parts redacted.

 

function FindProxyForURL(url, host)
{
//Variable strings to return
   var proxy_no = "DIRECT";
//If specific URL needs to bypass proxy, send traffic direct
   if (shExpMatch(url, "*.LEA.gov.uk*")) { return proxy_no; }
   if (shExpMatch(url, "http://School.IP.Range.*")) { return proxy_no; }
   if (shExpMatch(url, "http://localhost*")) { return proxy_no; }
   if (shExpMatch(url, "http://server*")) { return proxy_no; }
// If at school, use proxy
   if (isInNet(myIpAddress(), "School.IP.Range.0", "and.sub.net.nnn"))
       return "PROXY ProxyAdress:PORT";
   else
       return "DIRECT";
}

 

Obviously change the numbers to match your environment. That said, depending on your set-up you may not need to bother. Our laptops automatically go direct as the pac is not resolvable outside of the LEA network.

Posted

This is what I use -

 

function FindProxyForURL(url, host)
 {
   var ip = myIpAddress();
   var debug = "";

   if(debug)
   {
       alert("proxy.pac IP=" + ip + "  HOST=" + host + "  URL=" + url);
   }

     // All client PCs on the internal network will have a 10.x address, check if I have this
    if (shExpMatch(ip, "10.*"))
    {
            if(debug)
         {
                alert("Proxy for " + url);
            }
    return "PROXY eduproxy.bgfl.org:80";
    }

    // If you have a different IP then this isn't the School network
    else 
    {
            if(debug)
         {
     alert("You are not at School so going direct for " + url);
            } 
           return "DIRECT";
    }

 }

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