In node.js + socket.io I use this code to get user's IP address:
var clientIP = socket.handshake.headers['x-forwarded-for'] || socket.handshake.address.address;
But the result is wrong. I console.log
'd these values and got the following results:
socket.handshake.address.address
is obviously internal IP (127.x.x.x)
x-forwarded-for
is one of the cloud9's proxies (107.23.232.64, 54.236.78.114, 107.23.123.140).
So apparently double proxying is used and one of the proxy layers does not provie 'x-forwarded-for'
header, right? Is getting real IP of the user absolutely impossible with cloud9? It is essential for my project.