Wednesday, April 1, 2009

creating pac to auto config ipv6 proxy to access ipv4 sites

using polipo proxy to allow ipv6 only clients access ipv4 sites or other proxyable services, I created this pac file , so that browsers only need 'auto configuration' enabled. Works with chrome, firefox and IE , only tested in vista. The first function is a microsoft extension, and was required to get IE to work in vista. The other function is the default.

This pac file sends request that don't resolve to an ipv6 address to the proxy

function FindProxyForURLEx(url, host) {
if (shExpMatch(dnsResolveEx(host), "*:*"))
{
return "DIRECT";
} else {
return "PROXY myproxy:8123";
}
}

function FindProxyForURL(url, host) {
if (shExpMatch(dnsResolve(host), "*:*"))
{
return "DIRECT";
} else {
return "PROXY myproxy:8123";
}
}

No comments:

load testing