Skip to content

Instantly share code, notes, and snippets.

@joshontheweb
Created August 5, 2013 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshontheweb/6160503 to your computer and use it in GitHub Desktop.
Save joshontheweb/6160503 to your computer and use it in GitHub Desktop.
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