Permalink
Browse files

[fix] Use `req.connection` for all x-forward-* headers

  • Loading branch information...
1 parent 216d46d commit f6dc12a971fdd892614b32d2a4fb2ff39ddc0e67 @indexzero indexzero committed Aug 29, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/node-http-proxy.js
View
@@ -433,10 +433,10 @@ 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 && req.connection) {
+ if (options.enableXForwarded === true && req.connection && req.connection.socket) {
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';
+ req.headers['x-forwarded-proto'] = req.connection.pair ? 'https' : 'http';
}
//

0 comments on commit f6dc12a

Please sign in to comment.