Skip to content

Instantly share code, notes, and snippets.

@kirel
Created January 16, 2012 00:55
Show Gist options
  • Save kirel/1618324 to your computer and use it in GitHub Desktop.
Save kirel/1618324 to your computer and use it in GitHub Desktop.
var connect = require('connect'),
httpProxy = require('http-proxy'),
domain = process.env.DOMAIN,
port = process.env.PORT || 3000;
var proxy = new httpProxy.RoutingProxy();
connect.createServer()
.use('/api', function (req, res) {
req.headers.host = domain;
proxy.proxyRequest(req, res, { host: domain, port: 80 });
})
.use(connect.static(__dirname + '/public'))
.listen(port, function () { console.log("Listening on " + port); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment