diff --git a/lib/node-http-proxy.js b/lib/node-http-proxy.js index c9dbec5..4c53063 100644 --- a/lib/node-http-proxy.js +++ b/lib/node-http-proxy.js @@ -341,7 +341,8 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) { options = options || {}; options.host = options.host || this.target.host; options.port = options.port || this.target.port; - options.enableXForwarded = options.enableXForwarded || false; + options.enableXForwarded = + (undefined === options.enableXForwarded ? true : options.enableXForwarded); // // Check the proxy table for this instance to see if we need @@ -589,8 +590,8 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options options = options || {}; options.host = options.host || this.target.host; - options.port = options.port || this.target.port; // - + options.port = options.port || this.target.port; + if (this.proxyTable && !options.host) { location = this.proxyTable.getProxyLocation(req);