Skip to content

Instantly share code, notes, and snippets.

@chyld
Created August 1, 2014 23:52
Show Gist options
  • Save chyld/a8970bdf08ba172d3ea4 to your computer and use it in GitHub Desktop.
Save chyld/a8970bdf08ba172d3ea4 to your computer and use it in GitHub Desktop.
var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxy();
var options = {
'chyld.io': 'http://localhost:3001',
'library.chyld.io': 'http://localhost:3002'
}
require('http').createServer(function(req, res) {
try{
proxy.web(req, res, {target: options[req.headers.host]}, function(e){});
}catch(e){
}
}).listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment