davglass/express-extras — Issue #2: extras.fixIP is broken with newer version of nodejs
Author: sreuter
Created: 2011-12-13 17:18:59+00:00
State: open

req.socket.remoteAddress is protected and can't be overwritten.

i ditched extras.fixIP for the time beeing and doing something like this right now:

```javascript

var logger = express.logger({ format: '":date" :remote-addr :method :url HTTP/:http-version :status :referrer :res[Content-Length] :response-time ":user-agent"' });

var loggerForwarded = express.logger({ format: '":date" :req[X-Forwarded-For] :method :url HTTP/:http-version :status :referrer :res[Content-Length] :response-time ":user-agent"' });

app.use(function(req, res, next){
if(req.headers['x-forwarded-for']) {
return loggerForwarded(req, res, next);
next();
} else {
return logger(req, res, next);
next();
}
});
```