-
-
Save joshontheweb/6160503 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 httpProxy = require('http-proxy'); | |
// | |
// Addresses to use in the round robin proxy | |
// | |
var addresses = [ | |
{ | |
host: '192.241.227.80', | |
port: 80 | |
}, | |
]; | |
var i = 0; | |
var server = httpProxy.createServer(function (req, res, proxy) { | |
console.log('request received'); | |
proxy.proxyRequest(req, res, addresses[i]); | |
i = (i + 1) % addresses.length; | |
}); | |
server.on('upgrade', function(req, socket, head) { | |
console.log('upgrade request received'); | |
}); | |
server.listen(80); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment