Commit e9b3ec9b authored by indexzero's avatar indexzero

[fix] Set `x-forwarded-for` from req.connection.socket.remoteAddress if...

[fix] Set `x-forwarded-for` from req.connection.socket.remoteAddress if req.connection.remoteAddress is not defined
parent f1c0f641
...@@ -346,7 +346,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) { ...@@ -346,7 +346,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
// //
// Add `x-forwarded-for` header to availible client IP to apps behind proxy // 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. // Emit the `start` event indicating that we have begun the proxy operation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment