Created by: KimSchneider
We required the proxy table supports multiple random destinations for each configured request target.
var http = require('http'), httpProxy = require('http-proxy');
var options = { router: { '192.168.99.29': ['127.0.0.1:8000','127.0.0.1:9000'] } };
var proxyServer = httpProxy.createServer(options); proxyServer.listen(80);
http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('request successfully proxied to srv1: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2)); res.end(); }).listen(8000);
http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('request successfully proxied to srv2: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2)); res.end(); }).listen(9000);