edmullen dot net

IDN FIX WITH EXISTING PROXY - posted 2/14/05 on alt.fan.mozilla newsgroup by Michael Scovetta, Scovetta Labs

Hi guys!

Yes, you can certainly chain the setting into your existing proxy-setup. The entire idea of using a proxy.pac file is pretty simple, though not many docs exist on it-- here's one:


Here's the deal. The proxy.pac file is just a JavaScript file that your browser executes each time it loads a URL (before it actually loads it). The important function is:

function FindProxyForURL(url, host) {

This function returns either the string "DIRECT", meaning, 'don't go through a proxy server', "PROXY host:port", or "SOCKS host:port" to go through a proxy server.

What the IDNproxy.pac does is simply say:

If the host contains any "invalid" character, then use the proxy server "127.0.01:9999", which is your own machine, on port 9999. You obviously don't have a proxy server running on your own machine, so the request times out, and you get an error. You can easily add that check and redirect to the top of your own proxy.pac file for your network.

If you're going straight to a proxy server (instead of an auto-configuration file), you can add a very simple change to the IDNproxy.pac file:

* Proxy.pac workaround -- by Michael Scovetta
* Scovetta Labs
* www.scovettalabs.com/advisory/SCL-2005.002.txt
*/function FindProxyForURL(url, host){
var validChars = "abcdefghijklmnopqrstuvwxyz0123456789.-";
var lowerHost = host.toLowerCase();
for (i=0; i if (validChars.indexOf(lowerHost.charAt(i)) == -1) {
alert('Invalid character(s) in host name.');
return "PROXY";
}// change this last line to your normal proxy settings
return "PROXY YourNormalProxyServer:Port";

As the link above shows, you can have a very complicated setup-- you can pump the request to separate proxy servers if it's FTP vs HTTP, or on other ports, or even specific URLs. If you've got other questions, you can email them to me (via the feedback form on scovettalabs.com) -- or post it here.


Michael Scovetta

Scovetta Labs

This page last changed: Friday, July 24, 2015 - 01:55 PM USA Eastern Time

Copyright Ed Mullen | Contact Ed

click for home page