How to adapt a proxy auto-config file to a specific LAN?

0

I would like my Mac to use specific proxy auto-config settings when inside the office LAN but not use a proxy when connected to any other network.

How can I configure it in such a way? I suspect there should be a way to add a conditional in the pac file javascript to check whether the computer is currently inside the office LAN - but how?

My current pac file is something like this:

var normal = "DIRECT", officeproxy = "PROXY 192.168.1.2:3421";

function FindProxyForURL(url, host) {
    if(/^https:\/\/secure.com\//i.test(url)) {
        return officeproxy; 
    }
    return normal;
}

Thanks.

UrEl

Posted 2011-05-15T21:05:44.240

Reputation: 771

Answers

0

There's no way to check what network the computer is connected to per se; however, one can use different alternative methods of checking local hosts to attempt to guess the network:

myIpAddress() === officeip
isResolvable("intranet.office.local")

or such.

http://classic-web.archive.org/web/20061218002753/wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html

Hello71

Posted 2011-05-15T21:05:44.240

Reputation: 7 636