This example works in an environment where internal DNS resolves only internal host names. The goal is to use a proxy only for hosts that aren’t resolvable.
function FindProxyForURL(url, host) { if (isResolvable(host)) return "DIRECT"; else return "PROXY proxy.mydomain.com:8080"; }
This example requires consulting the DNS every time. Therefore, you would group this example with other rules so that DNS is consulted only if other rules do not yield a result.
function FindProxyForURL(url, host) { if (isPlainhost name(host) || dnsDomainIs(host, ".mydomain.com") || isResolvable(host)) return "DIRECT"; else return "PROXY proxy.mydomain.com:8080"; }