diff --git a/lib/connect-logger.js b/lib/connect-logger.js index a53f7e0..4f7a312 100644 --- a/lib/connect-logger.js +++ b/lib/connect-logger.js @@ -134,7 +134,7 @@ function assemble_tokens(req, res, custom_tokens) { default_tokens.push({ token: ':date', replacement: new Date().toUTCString() }); default_tokens.push({ token: ':referrer', replacement: req.headers.referer || req.headers.referrer || '' }); default_tokens.push({ token: ':http-version', replacement: req.httpVersionMajor + '.' + req.httpVersionMinor }); - default_tokens.push({ token: ':remote-addr', replacement: req.ip || req._remoteAddress || + default_tokens.push({ token: ':remote-addr', replacement: req.headers['x-forwarded-for'] || req.ip || req._remoteAddress || (req.socket && (req.socket.remoteAddress || (req.socket.socket && req.socket.socket.remoteAddress))) }); default_tokens.push({ token: ':user-agent', replacement: req.headers['user-agent'] }); default_tokens.push({ token: ':content-length', replacement: (res._headers && res._headers['content-length']) ||