[fix] connection.socket -> socket for source of x-forwarded-for data

This commit is contained in:
Joshua Holbrook 2011-09-20 14:34:03 -07:00
parent 66e982060c
commit 1f33943b23

View File

@ -130,7 +130,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
// //
if (this.enable.xforward && req.connection && req.socket) { 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-port'] = req.connection.remotePort || req.socket.remotePort;
req.headers['x-forwarded-proto'] = req.connection.pair ? 'https' : 'http'; req.headers['x-forwarded-proto'] = req.connection.pair ? 'https' : 'http';
} }