Skip to content

Instantly share code, notes, and snippets.

@acorcutt
acorcutt / RailsProxy.pac
Created January 5, 2011 17:59
This makes testing with domains and sub-domains easier on a mac, choose "Automatic Proxy Configuration" in Airport settings and set the URL to this file. Then any request to port 3000 will be pointed to the local rails server e.g. http://sub.mydomain.c
function FindProxyForURL(url, host) {
var port = url.match(/^\w{3,5}:\/\/[^:\/]*(:(\d+))?/)[2];
if(port){
if(port=="3000"){
var proxy = "PROXY localhost";
if(port){proxy += ":" + port;}
return proxy;
}
}