Firefox Windows 7 and Linux proxy.pac

Had a problem today with Firefox on Windows 7 and Firefox on Linux. Upon reading our proxy.pac (wpad) file the if statements were not working:

if(isInNet(myIpAddress(), “123.111.123.0″,”255.255.254.0″))


According to this post on Mozilla the problem is due to how FF/Win7 reports the ipv6 address, rather than the ipv4 version. So the solution was to add the CIDR version too e.g.

isInNet(myIpAddress(), “123.111.123.0″, “255.255.254.0″) ||
isInNet(myIpAddress(), “123.111.123.0″, “/23″) || 

Order has been restored!



Related Posts

Top of the Tops 2013

A revised list of my favourite tops htop htop can provide a little more info than the traditional to... Learn More

Cisco Router Emulation with G

I followed the GNS3 instructions for installation and simple topology. GNS3 can be installed from th... Learn More

Oracle Packaging Not So Eco-

This is what Oracle sent to replace a battery in a server. That little silver thing in the bag is th... Learn More

Very Cheap Wildcard SSL Certi

At $59 per year this has to be the cheapest Wildcard SSL cert ever my only deliberation is will the... Learn More

Chicken and Leek Pie with Cre

This is an adapted version of a Jamie Oliver Turkey Leek Pie and I will usually hunt the fridge for... Learn More

Solaris 11 Getting Started H

Im writing this from the perspective of a naive Linux admin so I may not be doing everything right a... Learn More

4 Responses to Firefox Windows 7 and Linux proxy.pac

Lieven | 882 days ago

Reply

I tried this solution but didn’t work for me.
The relevant code in my .pac script:

function FindProxyForURL(url, host) {
var proxy_a = “PROXY server1.lab.local:3128″;
var proxy_b = “PROXY server2.lab.local:3128″;
var proxy_no = “DIRECT”;

if (isResolvable(host)) { ip = dnsResolve(host); }
if (isInNet(ip, “127.0.0.1″, “255.255.255.0″)) { return proxy_no; }
if (isInNet(ip, “10.0.0.0″, “255.0.0.0″)) { return proxy_no; }

myip = myIpAddress();
if (isInNet(myip, “172.16.1.0″, “255.255.255.0″) || (isInNet(myip, “172.16.1.0″, “/24″)) { return proxy_a; }
if (isInNet(myip, “172.16.2.0″, “255.255.255.0″)) { return proxy_b; }
}

    Antman | 217 days ago

    Reply

    Line 11 of your .pac script has too many left brackets. Try:

    if (isInNet(myip, “172.16.1.0″, “255.255.255.0″) || isInNet(myip, “172.16.1.0″, “/24″)) { return proxy_a; }

Andy | 726 days ago

Reply

Try network.dns.disableIPv6 = True in Fireforx config (about:config in URL)

Aidan | 492 days ago

Reply

Thanks works perfectly.

Windows 7 + Firefox / IE9