diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 84ba1ac..faf133f 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -130,7 +130,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // if (this.enable.xforward && req.connection && req.socket) { - req.headers['x-forwarded-for'] = req.connection.remoteAddress || req.connection.socket.remoteAddress; + req.headers['x-forwarded-for'] = req.connection.remoteAddress || req.socket.remoteAddress; req.headers['x-forwarded-port'] = req.connection.remotePort || req.socket.remotePort; req.headers['x-forwarded-proto'] = req.connection.pair ? 'https' : 'http'; }