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.
Linux NetworkingWindows NetworkingLinuxMicrosoft Legacy OSPrinters and Scanners

Avatar of undefined
Last Comment
Chris Dent

8/22/2022 - Mon
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.
ASKER
Steven Vona

It is, and it is not working.
Tony J

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Chris Dent


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
ASKER
Steven Vona

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
Chris Dent

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Steven Vona

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.  
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Chris Dent


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

Chris