Hooking into Firefox' auto-detect proxy settings

0

1

I have a squid proxy server running on my home server. I'd like my Firefox to use this proxy server when I'm in my home network, and otherwise use no proxy or some other network's proxy.

In Firefox' proxy settings, there's an option "Auto-detect proxy settings for this network". How do I make Firefox able to detect my proxy?

Alex

Posted 2012-04-14T10:38:30.633

Reputation: 113

Answers

0

See this Wikipedia page on WPAD for how proxy autodetection works. Remember, DHCP based WPAD does not work in Firefox.

In your case you'd probably want to use Automatic proxy configuration URL. PAC files can check which subnet you are on (e.g. 192.168.1.x vs 192.168.2.x vs 10.5.x.x, etc), so if the home network uses a subnet unique to other networks you connect to, this will work. More information here.

Basic check for subnet you are in (taken from last link):

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

Bob

Posted 2012-04-14T10:38:30.633

Reputation: 51 526

After 12 years (but who's counting) bug 356831 was fixed: Firefox 63 supports DHCP option 252 for proxy configuration. This feature has yet to appear in ESR (currently v60) where it would actually be useful :/

– mr.spuratic – 2018-12-18T17:35:57.380

Thanks. While my subnet isn't unique, I'm sure I can either change that or find other ways to get around the issue. – Alex – 2012-04-15T08:29:50.453