Update SocketIORouter.js

Changed the setting of client.remoteAddress
pull/1756/head
spruce 2013-04-22 23:01:41 +03:00
parent f0f98b41fe
commit 6ea5efbcc3
1 changed files with 6 additions and 1 deletions

View File

@ -55,7 +55,12 @@ exports.setSocketIO = function(_socket)
socket.sockets.on('connection', function(client) socket.sockets.on('connection', function(client)
{ {
client.set('remoteAddress', client.handshake.address.address); if(client.handshake.headers['x-forwarded-for'] === undefined){
client.set('remoteAddress', client.handshake.address.address);
}
else{
client.set('remoteAddress', client.handshake.headers['x-forwarded-for']);
}
var clientAuthorized = false; var clientAuthorized = false;
//wrap the original send function to log the messages //wrap the original send function to log the messages