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!

4 Responses to “Firefox Windows 7 and Linux proxy.pac”

  1. Lieven

    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; }
    }

    Reply
    • Antman

      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; }

      Reply

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>