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 get multiple IPs , this works for me:
var ipaddress = (req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAddress || req.connection.socket.remoteAddress).split(",")[0];