How can I determine the IP address of a given request from within a controller? For example (in express):
app.post(\'/get/ip/address\', function (req, res) {
If you're using express version 3.x or greater, you can use the trust proxy setting (http://expressjs.com/api.html#trust.proxy.options.table) and it will walk the chain of addresses in the x-forwarded-for header and put the latest ip in the chain that you've not configured as a trusted proxy into the ip property on the req object.