I'm working on serving up a website using Node.js and Express. One issue I'm having is getting the client browser's IP address logged -- it's consistently coming up as 127.0.0.1. I'm assuming there's something with the way Webfaction is routing the request as I can get it working on my development machine. I'm using the Connect middleware for logging, and using either the default format string, which uses ":remote-addr", or a custom format string that uses ":res[x-forwarded-for]", both of which give me only 127.0.0.1 as the resulting address. Has anyone else experienced this? Anyone know of a workaround or a different token to use in the format string? Thanks. asked 02 Jan '14, 05:43 rsgoheen |
I think you need to enable "trust proxy" in your express settings. See the following URLs for more info: Hope that helps! answered 02 Jan '14, 16:38 seanf |