Jump to content

Recommended Posts

Posted (edited)

Im having a strange issue whereby when a client connects to an internal resource, it is completely ignoring the "use direct bit" and going via the proxy. I can tell this from running a wireshark capture. The issue is more prevalent recently as when the LEA internet connection goes, clients are unable to access internal services such as webmail or our vle (both hosted internally).

 

Here is the content of my pac file:

 

{
   if (
       dnsDomainIs(host, "webmail.domain.internal") ||
       dnsDomainIs(host, "vle.domain.internal") ||
       dnsDomainIs(host, "xenapp.domain.internal") ||
       isInNet(host, "127.0.0.1", "255.255.255.255") ||
       isInNet(host, "172.31.1.1","255.255.255.255")
      ) 
       return "DIRECT";
   else
       return "PROXY xx.xx.xx.xx:8881";
}

 

Now, the proxy pac is being served up fine, and happens across both IE7 and Firefox. So perhaps it is just a logic issue?? But it looks fine to me! :confused: Anyone shed any light?

 

**edit** to correct paste errors

Edited by Oops_my_bad
Posted
The above answers are correct - in fact, if my memory of javascript's internal workings serves, you will only return "DIRECT" in cases where it is *not* any of those hosts.
  • Thanks 1
Posted (edited)

Jeez, was that all it was then? I feel like a noob :o

 

So my revised pac file should go something like:

 

{
   if (
       dnsDomainIs(host, "webmail.domain.internal") ||
       dnsDomainIs(host, "vle.domain.internal") ||
       dnsDomainIs(host, "xenapp.domain.internal") ||
       isInNet(host, "127.0.0.1", "255.255.255.255") ||
       isInNet(host, "172.31.1.1","255.255.255.255")
      ) 
       return "DIRECT";
   else
       return "PROXY xx.xx.xx.xx:8881";
}

 

Yas?

Edited by Oops_my_bad
Posted
Actually I've just checked our original pac and it hadnt pasted over to here properly, our pac is exactly as above with the OR operator omitted before the use direct :(
Posted

Pardon me if this sounds a bit obvious but there seems to be some brackets missing.

{
   if (
       dnsDomainIs(host, "webmail.domain.internal") ||
       dnsDomainIs(host, "vle.domain.internal") ||
       dnsDomainIs(host, "xenapp.domain.internal") ||
       isInNet(host, "127.0.0.1", "255.255.255.255") ||
       isInNet(host, "172.31.1.1","255.255.255.255")
      ) {
       return "DIRECT";
   }
   else {
       return "PROXY xx.xx.xx.xx:8881";
   }
}

  • Thanks 1
Posted (edited)

Thanks!

 

Here's what we have so far.. it is working but I wont really know unless the connection goes down!

 

function FindProxyForURL(url, host)
{
   if (
dnsDomainIs(host, "webmail.domain.internal") ||
dnsDomainIs(host, "vle.domain.internal") ||
dnsDomainIs(host, "xenapp.domain.internal") ||
isInNet(host, "127.0.0.1", "255.255.255.255") ||
            isInNet(host, "172.31.1.1","255.255.255.255")
      ) 
{
      return "DIRECT";
}
   else
{
       	      return "PROXY xx.xx.xx.xx:8881";
}
}

 

Apologies for the poor formatting of code on here.. but looks good yes?

Edited by Oops_my_bad
Posted

isInNet(host, "172.31.1.1","255.255.255.255")

 

 

looks to be a problem to me, should this not be 255.255.255.0 or whatever your subnet mask is?

Posted

This is what I use, it is a bit of a mess, but does what I need...

 

I find having the proxy defs at the top helps if I need to change them.

 

And yes I know a lot of these could be grouped together, but I prefer the readability of separate checks.

 

function FindProxyForURL(url, host)
{
// Proxy definitions
var proxy_main = "PROXY xxxx:80; ";
var proxy_SVEN_SECURE = "PROXY xxxxx:8080; ";
var proxy_fallback = "PROXY xxxx:80; ";
var proxy_no = "DIRECT";

// Proxy if on Admin LAN - no proxy
if (isInNet(myIpAddress(), "xxxxx", "255.255.255.0"))
{
	return proxy_no;
}
// else if looking at  proxy (probably blocked page) - no proxy
else if (shExpMatch(url, "http://xxxx*") ||
		 shExpMatch(url, "http://xxxx*")
		)
{
	return proxy_no;
}
// else if looking at a machine on the curric network - no proxy
else if (isInNet(host, "xxxx", "255.255.248.0"))
{
	return proxy_no;
}
// else if looking at a machine on the admin network - no proxy
else if (isInNet(host, "xxxx", "255.255.255.0"))
{
	return proxy_no;
}
// else if looking at a machine on the SVEN network - no proxy
else if (isInNet(host, "xxxx", "255.255.255.0"))
{
	return proxy_no;
}
// else if certain sites - force proxy
else if (//shExpMatch(url, "*xxxx*") ||
		 0
		)
{
	return proxy_main + proxy_fallback;
}
// else if certain sites - no proxy
else if (shExpMatch(url, "*.xxx*") ||
		 shExpMatch(url, "*.xxx*") ||
		 shExpMatch(url, "*xxx*") ||
		 shExpMatch(url, "*xxx*") ||
		 0
		)
{
	return proxy_no;
}
// else if a secure site - alternative proxy for secure sites
else if (shExpMatch(url, "https://*"))
{
	return proxy_SVEN_SECURE;
}
// else use normal proxy and fallback proxy as backup
else
{
	return proxy_main + proxy_fallback;
}
}

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