How to configure auto-proxying in Chrome

If you need to access SOME websites using proxy (only few of them), you might like to use Proxy Autoconfiguration feature (or PAC). Google Chrome can do it and its a piece of cake to configure it. Create a file my-proxy.pac somewhere with this content:

function FindProxyForURL (url,host) {
var hosts = ["",""];
for(var i=0;i<hosts.length;i++) {
if (shExpMatch(url,"*."+hosts[i]+"/*")||shExpMatch(url,"*//"+hosts[i]+"/*")) {
return "PROXY; DIRECT";
return "DIRECT";

Now in Windows you would be configuring the path for PAC file in the Under the hood configuration screen. But its not there in Linux. In this case you need to add one line to your .bashrc:

export auto_proxy=file:///home/lzap/my-proxy.pac

Re-login and you are done. Nice.
20 June 2011 | chrome | google