Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix #95 Don't look on req.connection if it's not set.

  • Loading branch information...
commit 62201a0917271db4ed0a08fc6f39e3fc76e8c178 1 parent 1389b70
@isaacs isaacs authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/node-http-proxy.js
View
2  lib/node-http-proxy.js
@@ -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';
Please sign in to comment.
Something went wrong with that request. Please try again.