diff --git a/lib/node-http-proxy.js b/lib/node-http-proxy.js index df3d6dc..43fa054 100644 --- a/lib/node-http-proxy.js +++ b/lib/node-http-proxy.js @@ -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.