Barış Soner Uşaklı 7 years ago
parent 0c60351960
commit a37dc1856f

@ -64,7 +64,7 @@ Sockets.init = function (server) {
}; };
function onConnection(socket) { function onConnection(socket) {
socket.ip = socket.request.headers['x-forwarded-for'] || socket.request.connection.remoteAddress; socket.ip = (socket.request.headers['x-forwarded-for'] || socket.request.connection.remoteAddress || '').split(',')[0];
logger.io_one(socket, socket.uid); logger.io_one(socket, socket.uid);
@ -244,7 +244,7 @@ Sockets.reqFromSocket = function (socket, payload, event) {
params: data[1], params: data[1],
method: event || data[0], method: event || data[0],
body: payload, body: payload,
ip: headers['x-forwarded-for'] || socket.ip, ip: socket.ip,
host: host, host: host,
protocol: encrypted ? 'https' : 'http', protocol: encrypted ? 'https' : 'http',
secure: encrypted, secure: encrypted,

Loading…
Cancel
Save