Created
January 16, 2012 00:55
-
-
Save kirel/1618324 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
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