[fix] Set x-forwarded-for from req.connection.socket.remoteAddress if req.connection.remoteAddress is not defined

This commit is contained in:
indexzero 2011-05-19 02:27:38 -04:00
parent f1c0f641aa
commit e9b3ec9b1d

View File

@ -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.