Created
October 22, 2012 03:12
-
-
Save deoxxa/3929449 to your computer and use it in GitHub Desktop.
i broked it :< :< :< :< :<
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 http = require('http'), | |
httpProxy = require('http-proxy'); | |
var proxy = new httpProxy.RoutingProxy(); | |
http.createServer(function (req, res) { | |
console.log("got request for proxy"); | |
process.nextTick(function() { | |
proxy.proxyRequest(req, res, { | |
host: 'localhost', | |
port: 9000, | |
}); | |
}); | |
}).listen(8001); | |
http.createServer(function (req, res) { | |
console.log("got request for server"); | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
res.write('request successfully proxied: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2)); | |
res.end(); | |
}).listen(9000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment