Skip to content

Commit

Permalink
Fix #95 Don't look on req.connection if it's not set.
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Aug 28, 2011
1 parent 1389b70 commit 62201a0
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 @@ -428,7 +428,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.enableXForwarded === true) {
if (options.enableXForwarded === true && req.connection) {
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 62201a0

Please sign in to comment.