From 5f9a5872759ca68a6e2c744eb04b5f7cc6ba9efd Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Thu, 4 Apr 2024 22:19:37 +0200 Subject: [PATCH] [mirotalksfu] - fix --- app/src/Server.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/Server.js b/app/src/Server.js index 5f12fe31..6783b563 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -1983,13 +1983,14 @@ function startServer() { return req.headers['x-forwarded-for'] || req.socket.remoteAddress; } function allowedIP(ip) { - const allowedIPs = authHost.getAuthorizedIPs(); - log.info('Allowed IPs', { ip: ip, allowedIPs: allowedIPs }); - return authHost != null && authHost.isAuthorizedIP(ip); + const authorizedIPs = authHost.getAuthorizedIPs(); + const authorizedIP = authHost.isAuthorizedIP(ip); + log.info('Allowed IPs', { ip: ip, authorizedIP: authorizedIP, authorizedIPs: authorizedIPs }); + return authHost != null && authorizedIP; } function removeIP(socket) { if (hostCfg.protected) { - let ip = socket.handshake.address; + const ip = socket.handshake.headers['x-forwarded-for'] || socket.handshake.address; if (ip && allowedIP(ip)) { authHost.deleteIP(ip); hostCfg.authenticated = false;