Whitelist proxying in Firefox

Hi there,

I have a very specific use case, which accessing self host websites in my own home lab, which are in an isolated network. Torsocks is running correctly on my linux installation.

So for my everyday use of the webservices, I’d like to set up proxy whitelists for these domains:

*mydomain.org (including all subdomains)

mysubdomain.free.com

I have of course no skills to write my own config script for this, so I’m just using trial and error.

So following instruction on a forum I tried this, but it’s broken:


function FindProxyForURL(url, host) {
    if (dnsDomainIs(mydomain.org, "*mydomain.org")) {
        return "SOCKS5 127.0.0.1:9050";
    }
}

function FindProxyForURL(url, host) {
    if (dnsDomainIs(mysubdomain.free.com, "mysubdomain.free.com")) {
        return "SOCKS5 127.0.0.1:9050";
    }
}

Can anyone help me fix this?

Thanks in advance!

If I understand correctly, you are attempting to use Tor for everything but the internal domain that you wish to whitelist (bypass Tor). The script example appears to be a PAC (Proxy Auto-Configuration) file.

I think you have the logic backwards. It appears that you are testing for your internal domain, but instead of bypassing Tor, it is sending that traffic to Tor.

I have never written a PAC file, but I think you need to change those entries to a “Return Value Format” of “DIRECT”:

With all that being said, I can find no reference of bypassing “torsocks” using a PAC file.

Maybe use a second browser for your internal domain.

Ok, so got some help from the internet.

In case someone else needs this, the correct script for the Proxy Auto-Configuration (PAC) file was in my case:

function FindProxyForURL(url, host) {
    if (dnsDomainIs("*mydomain.org", host)) {
        return "SOCKS5 127.0.0.1:9050";
    }

    if (dnsDomainIs("mysubdomain.free.com", host)) {
        return "SOCKS5 127.0.0.1:9050";
    }
    return DIRECT;
}