Skip to content

Commit

Permalink
[fix] Set x-forwarded-for from req.connection.socket.remoteAddress …
Browse files Browse the repository at this point in the history
…if req.connection.remoteAddress is not defined
  • Loading branch information
indexzero committed May 19, 2011
1 parent f1c0f64 commit e9b3ec9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/node-http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
//
// Add `x-forwarded-for` header to availible client IP to apps behind proxy
//
req.headers['x-forwarded-for'] = req.connection.remoteAddress;
req.headers['x-forwarded-for'] = req.connection.remoteAddress || req.connection.socket.remoteAddress;

//
// Emit the `start` event indicating that we have begun the proxy operation.
Expand Down

0 comments on commit e9b3ec9

Please sign in to comment.