Last Updated: February 25, 2016
·
3.665K
· purekrome

The worlds most awesome proxy pac file!

A simple Proxy auto-configuration file.

Goal: Use the proxy (if it's up/working) or the direct internet (aka your Gateway) for retrieving data

UNLESS

the domain name (where you're trying to retrieve data from) resolves back to 127.0.0.1 || localhost. If it's the later, then don't use the proxy (obviously) and go direct (which means, you hit your own machine):

var direct = "DIRECT";
var proxy = "PROXY 192.168.1.2:3128; " + direct;

function FindProxyForURL(url, host)
{
    if (dnsResolve(host) == "127.0.0.1")
    {
        // Avoid using proxy for any domain that is resolved to be *localhost*.
        // Eg. foo.localtest.me
        return direct;
    }
    else
    {
        return proxy;
    }
}