-
-
Save tanepiper/a01ae972d25231ad59e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.mount(function(req) { | |
if ( !req.headers['x-forwarded-for'] && /\/s.gif|\/s.json/.test(req.url) === true ) { | |
return true; | |
} | |
return false; | |
}, function(req, bounce) { | |
var subdomains = /(www\.|count\.)/; | |
var matches = req.headers.host.match(subdomains); | |
var host; | |
if (matches) { | |
host = req.headers.host.replace(matches[1], ''); | |
} else { | |
host = req.headers.host; | |
} | |
var url = host + '/pb' + req.url; | |
bounce(url); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment