Skip to content

Commit

Permalink
Updating to enableXForwarded
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBUK committed Jul 19, 2011
1 parent 404818b commit ee3506a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/node-http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ HttpProxy.prototype.close = function () {
// options.host {string} Host of the proxy target.
// options.buffer {Object} Result from `httpProxy.buffer(req)`
// options.https {Object|boolean} Settings for https.
// options.allow_xforwarded_headers {boolean} Don't clobber x-forwarded headers to allow layered proxies.
// options.enableXForwarded {boolean} Don't clobber x-forwarded headers to allow layered proxies.
//
HttpProxy.prototype.proxyRequest = function (req, res, options) {
var self = this, errState = false, location, outgoing, protocol, reverseProxy;
Expand All @@ -341,7 +341,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
options = options || {};
options.host = options.host || this.target.host;
options.port = options.port || this.target.port;
options.allow_xforwarded_headers = options.allow_xforwarded_headers || false;
options.enableXForwarded = options.enableXForwarded || false;

//
// Check the proxy table for this instance to see if we need
Expand Down Expand Up @@ -381,7 +381,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
// * `x-forwarded-proto`: Protocol of the original request
// * `x-forwarded-port`: Port of the original request.
//
if (options.allow_xforwarded_headers == true) {
if (options.enableXForwarded == true) {
req.headers['x-forwarded-for'] = req.connection.remoteAddress || req.connection.socket.remoteAddress;
req.headers['x-forwarded-port'] = req.connection.remotePort || req.connection.socket.remotePort;
req.headers['x-forwarded-proto'] = res.connection.pair ? 'https' : 'http';
Expand Down

0 comments on commit ee3506a

Please sign in to comment.