Dispatches From The Geeks

News and Announcements from the MCS Systems Group

Changed the Proxy config

Last night I made a change to the browser proxy autoconfiguration script to make it more user friendly. Now, it will bypass the proxy for FTP links, since we never intended for it to proxy FTP, and will automatically fall back to using no proxy if it finds the proxy is unreachable.For those who like the technical details, read on. For those playing along at home, here’s the deal. If you configure your browser to set its proxy settings by using an autoconfiguration URL (or “configure via a .pac file”), and point it at:http://www.mcs.anl.gov/proxy/proxy.pacYou’ll get the right proxy behavior. A rule exists on the web server, like so:

rewritecond %{remote_addr} ^130.202.96. [OR]rewritecond %{remote_addr} ^130.202.97. [OR]RewriteCond %{remote_addr} ^140.221.18.RewriteRule ^/proxy/proxy.pac /proxy/proxy-vpn.pac

This rule says that if you’re coming from, or (wireless, wireless and VPN, respectively), instead of proxy.pac, you’ll be handed proxy-vpn.pac.proxy.pac says this:

function FindProxyForURL(url, host){return "DIRECT";}

i.e. NOOP.proxy-vpn.pac *used* to say this:

function FindProxyForURL(url, host){return "PROXY echo.mcs.anl.gov:3131";}

Which routed all your stuff through echo. Turns out this had two flaws. One being that echo isn’t set up to be an FTP proxy (we never intended to proxy FTP), and the other being that some browsers would not detect the change in networks and just fail to load anything if you left the above-mentioned networks without quitting the browser.The new file takes care of both these cases:

function FindProxyForURL(url, host){if (url.substring(0, 4) == "ftp:") { return "DIRECT"; }else { return "PROXY echo.mcs.anl.gov:3131;DIRECT"; }}

First case tells FTP traffic not to proxy, second case says to try echo, and if that fails, then go about doing things normally.This should lead to a happier experience, methinks.–Craig


Written by Craig Stacey

February 21, 2007 at 3:08 am

Posted in Uncategorized

Tagged with

%d bloggers like this: