Jump to content

Recommended Posts

Posted

ive done a search and can come up with nothing i quite get.

 

Im trying to write a pac file so when ip address starts with 10 (i would of thought keeps it simple) it uses a proxy if it dosent it wont (so teachers can take laptops home (they do have reg file on the desktop to turn the proxy on and off but aparantly thats too techincal/hard/cant be bothered for some of them))

 

from what i can gather my script should work but it seems to do nothing and i cant see why as it seems that 0 function as a wildcard so my read on the code is basically if my ip is 10.whatever use a proxy if its not dont but when i try it it dosent use a proxy at all any ideas? I cant even see a way of checking the output other than running ie and it failing to go to a website

 

function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(),"10.0.0.0","255.255.252.0"))
return "PROXY myproxy.local:80";
else
return "DIRECT";
}

Posted

i couldn't get this to work either.

 

what you could do is host the .PAC file on a web server and set the clients to auto detect as when they get home that will work too..

 

you need to register an a record wpad and point it to the webserver

then in the root of the web server call your PAC file wpad.dat

 

if (isInNet(host, "10.7.56.0", "255.255.252.0")) {
  return "DIRECT";}

return "PROXY proxy.thecryptschool.lan:8080; DIRECT";

Posted

If you use GPOs on your network, you can simply set the GPO (for the computer I think it is off hand I'm on a different site at the moment without an AD in place .. :confused: .. ooo RDP :doh: .. hang on)

 

Right...

 

Under the USER settings (not computer as I initially though!) under Internet Explorer Maintenance (you may need to download the Admin Template for it from Microsoft) under Connection then choose Automatic Browser Configuration and put the details to your proxy.pac in there (obviously enable it first) and make sure this is on a machine that is in your school (so your server if you have IIS set up for instance, but then you'll have to ensure you make sure you set up the correct MIME type for the .pac file so it knows how to handle it.

 

Once this is done, the staff laptop will simply know from the GPO to look for the proxy.pac (or whatever you call it) at http://your.server.address/proxy.pac. If that machine is on the network then GREAT, it finds it, all your proxies are set up and everything works .. however, when they're out of school, it can't find the proxy.pac file and simply reverts to looking for automatic settings from the staffs own home internet.

 

I hope that makes sense, it took me ages to figure it out with lots of test settings, but when I got it to work, it's been great ever since with no more pitchforks and flaming torches waiting at my desk accompanied by angry staff members as they couldn't get onto Facebook or something, I mean work related sites! lol ..

Posted

This the .pac file we use & it seems to work -

 

function FindProxyForURL(url, host)

{

if (isPlainHostName(host) || localHostOrDomainIs(host, "10.0.0.200") || localHostOrDomainIs(host, "smoothwall.yourdomain.name"))

return "DIRECT";

 

else

return "PROXY 10.0.0.200:8080";

}

Posted
function FindProxyForURL(url, host)
{

// Variable strings to return

var proxy_yes = "PROXY 172.16.0.197:8000";
var proxy_no = "DIRECT";

// Execptions for direct connection

if (shExpMatch(url, "http://printers:9191/*")) { return proxy_no; }
if (shExpMatch(url, "https://printers:9191/*")) { return proxy_no; }
if (shExpMatch(url, "http://zimbra/*")) { return proxy_no; }
if (shExpMatch(url, "https://zimbra/*")) { return proxy_no; }
if (shExpMatch(url, "http://server1*")) { return proxy_no; }
if (shExpMatch(url, "https://server1*")) { return proxy_no; }


// Proxy if PC is on local LAN

if (isInNet(myIpAddress(), "172.16.0.0", "255.255.0.0"))
return "PROXY 172.16.0.197:8000";

// Below for Firefox bug when running on Linux by checking localhost

else if (isInNet(myIpAddress(), "127.0.0.0", "255.0.0.0"))
return "PROXY 172.16.0.197:8000";

// Everything else to go direct

else
return "DIRECT";
} 

Posted

Hi All,

 

My next post is about auto detecting proxy settings but I can't posts links in my first post so...

 

Hello and read on! :D

 

Shaun

Posted

Hi All,

 

This is how I have proxy autoconfig set up in a number of primary schools.

 

I used this information: FindProxyForURL.com - PAC & WPAD Resource (sorry, 1st post won't let me do URL links)

 

The important parts are...

 

...choosing to use either DNS or DHCP (or both). I use DNS personally as some PC's are on static IPs

 

...making sure you add the mime type (.dat = application/ns-proxy-autoconfig) on your web server

 

...keeping your wpad simple and expand it (exceptions) when you know it works

Make sure to test at each stage:

 

...knowing that WPAD as a dns entry may be blocked. If you can't ping it, your clients can't download the pac/wpad file. Do a search online about unblocking this but read the security rasons why it is blocked.

 

...testing the download of the wpad/pac in your browser. e.g. http://wpad/wpad.dat.

 

Hope this helps. The link above was really useful to me.

 

Shaun

Posted

alternatively you could use ProxySwitcher from:

Onyx Box

 

"...Proxy Switcher is a small tray icon type utility that allows you to select whether Windows and Mozilla Firefox should use a proxy server for Internet access in a couple of clicks..."

 

Unfortunately it's no longer freeware since i last downloaded it earlier this year, but i could send you the last freeware version...or you could send the guy a donation.

Posted
we actually isntall proxypal (which is free) on our staff laptops and put the button next to the home button it simply enables and disables the proxy at the click of a button.
Posted
we actually isntall proxypal (which is free) on our staff laptops and put the button next to the home button it simply enables and disables the proxy at the click of a button.

 

The point of this is that you don't need to click a button, and it works cross platform on multiple browsers/phones etc

Posted

This one works perfectly for me.

 

function FindProxyForURL(url,host)
{ if(isPlainHostName(host) || 
    isInNet(host,"10.12.92.0","255.255.252.0")) return "DIRECT"; 
  else return "PROXY 92.43.65.65:80; 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...