Link to home
Start Free TrialLog in
Avatar of Steven Vona
Steven VonaFlag for United States of America

asked on

Proxy.pac file without a domain

I have a small workgroup of about 10 computers, (9 windows workstations, 1 Linux box).  The linux box works as squid proxy,web server and file/print server.

Right now we have all the proxy settings in the PC's and it all works great.  We are expecting to get about 6 laptops for some of our employees.  They will need to use the proxy server when in the office, but not when they are out of the office.

Since they will all be hard coded the browser settings will have to be changes everytime they leave the office.  I wanted to use a proxy.pac/wpad.dat file for this.

I created the following proxy.pac file and also make a symbolic link wpad.dat > proxy.pac in the root directory of our webserver:

    function FindProxyForURL(url, host)
    {
    if (isInNet(myIpAddress(), "10.0.0.0", "255.255.255.0"))
    return "PROXY 10.0.0.2:8080";
    else
    return "DIRECT";
    }

I also added a DNS A record wpad.ourdomain.com pointing to 10.0.0.2.


but it doesnt seem to be working.  Is this because we do not have a domain so the browser doesnt know where to look for the proxy.pac file?

Any help would be appreciated.
Avatar of brettkm
brettkm

You don't need a domain, but the proxy.pac file has to be kept on a webserver that all computers can get to.

http://<webserver>/proxy.pac for example.
Avatar of Steven Vona

ASKER

It is, and it is not working.

The advantage of wpad.dat is that it'll work for things other than IE, a big bonus for me :)

However, to find wpad the client will construct a DNS query, appending the Primary DNS Suffix onto a query for "wpad". Setting a Primary DNS Suffix on a client does not mean you need to be a member of a domain. It can be set independently.

Do note that you can check your script first by telling a browser to use a specific auto-configuration script with the full URL. Either of these should work if you have both files:

http://wpad.yourdomain.com/proxy.pac
http://wpad.yourdomain.com/wpad.dat

You should also check you can actually retrieve the script from the web server, browse to the URL above and check you can open the script in Notepad.

A few others things to check:

1. MIME Types - Depending on the web server you may been to add .pac or .dat to the MIME type list
2. The script. It looks fine, but you always have to keep an eye out for syntax problems :)

Chris
Thanks for all the comments...

1) DNS entry has been created

2) I can get to the proxy.pac/wpad.dat file by just putting the URL into the browser, so there should be no problem there.

3) Changed the MIME type in apache config:
AddType application/x-javascript-autoconfig .pac

Another thing to note is that it works perfectly for IE, but firefox seems to be ignoring the proxy.pac file.  

I do see in my apache logs that fiefox is retrieving the proxy.pac file every time it starts:

10.0.0.3 - - [06/Dec/2010:10:30:04 -0500] "GET /proxy.pac HTTP/1.1" 200 177 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729)"

But for some reason it is still not working... Any help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, so I took your advice and changed the script to:

function FindProxyForURL(url, host) { return "PROXY 10.0.0.2:8080"; }

and it works.

But I was testing the subnet because some of the laptops are taken home with our workers.  When the go home I want their internet to work without a proxy.  

It will, because when they're at home they won't find the autodiscovery script :) Unless, you made the script publicly available?

Chris