Fix unique IPs in the admin panel when using nginx

pull/1/head
yflory 6 years ago
parent f4bf032513
commit 74a0252712

@ -1525,9 +1525,11 @@ var getActiveSessions = function (Env, ctx, cb) {
Object.keys(ctx.users).forEach(function (u) {
var user = ctx.users[u];
var socket = user.socket;
var conn = socket.upgradeReq.connection;
if (ips.indexOf(conn.remoteAddress) === -1) {
ips.push(conn.remoteAddress);
var req = socket.upgradeReq;
var conn = req && req.connection;
var ip = (req && req.headers && req.headers['x-forwarded-for']) || (conn && conn.remoteAddress);
if (ip && ips.indexOf(ip) === -1) {
ips.push(ip);
}
});

Loading…
Cancel
Save