Skip to content
Permalink
Browse files

[fix] closes #547

  • Loading branch information...
yawnt committed Jan 16, 2014
1 parent 0ba4fa8 commit 4351ed1c86c8336b3a2d9f80098dcb2c9180685d
Showing with 8 additions and 1 deletion.
  1. +7 −0 lib/http-proxy.js
  2. +1 −1 lib/http-proxy/index.js
@@ -8,6 +8,13 @@ var http = require('http'),
*/
module.exports = httpProxy.Server;

module.exports.createProxy = function(options) {
return {
web: httpProxy.createRightProxy('web')(options),
ws: httpProxy.createRightProxy('ws')(options)
};
}

/**
* Creates the proxy server.
*
@@ -80,7 +80,7 @@ function createRightProxy(type) {
};
};
}

httpProxy.createRightProxy = createRightProxy;

function ProxyServer(options) {
EE3.call(this);

1 comment on commit 4351ed1

@trusktr

This comment has been minimized.

Copy link

commented on 4351ed1 Feb 8, 2014

@yawnt If you could add to the main documentation info regarding how to make "proxy tables" like in the example you've mentioned at https://blog.nodejitsu.com/node-http-proxy-1dot0/ that would be very helpful!

var httpProxy = require('http-proxy')

var proxy = httpProxy.createProxy();

var options = {
  'foo.com': 'website.com:8001',
  'bar.com': 'website2.com:8002'
}

require('http').createServer(function(req, res) {
  proxy.web(req, res, {
    target: options[req.headers.host]
  });
}).listen(8000);

^^^ If you could provide more examples of that type of usage, that would be extremely helpful. Thanks!

Please sign in to comment.
You can’t perform that action at this time.