Example of a PAC file

A very simple example of a PAC file is:
function FindProxyForURL(url, host)
{
return "PROXY proxy.example.com:8080; DIRECT";
}

This function instructs the browser to retrieve all pages through the proxy on port 8080 of the server proxy.example.com. Should this proxy fail to respond, the browser contacts the Web-site directly, without using a proxy. 

Example from http://www.goyun.info/wpad.dat

function FindProxyForURL(url, host)
{
return "DIRECT; SOCKS5 localhost:1080; SOCKS5 localhost:8888";
}

A more complicated example demonstrates some available JavaScript functions to be used in the FindProxyForURL function:
function FindProxyForURL(url, host) {
// our local URLs from the domains below example.com don't need a proxy:
if (shExpMatch(host, "*.example.com"))
{
return "DIRECT";
}

// URLs within this network are accessed through
// port 8080 on fastproxy.example.com:
if (isInNet(host, "10.0.0.0", "255.255.248.0"))
{
return "PROXY fastproxy.example.com:8080";
}

// All other requests go through port 8080 of proxy.example.com.
// should that fail to respond, go directly to the WWW:
return "PROXY proxy.example.com:8080; DIRECT";
}

Comments

Popular posts from this blog

Check MySQL query history from command line

Installing chocolatey on Windows