diff --git a/deploy/websocket_server/websocket_server.py b/deploy/websocket_server/websocket_server.py index 353a67ca..5a36cd22 100644 --- a/deploy/websocket_server/websocket_server.py +++ b/deploy/websocket_server/websocket_server.py @@ -113,7 +113,7 @@ def bin_sort(bin): async def alerts_data(websocket, client, shared_data, alert_version): - client_ip, client_port = websocket.remote_address + client_ip = websocket.headers.get("X-Real-IP") while True: if client["firmware"] == "unknown": await asyncio.sleep(0.1) @@ -194,7 +194,9 @@ def send_google_stat(tracker, event): async def echo(websocket, path): - client_ip, client_port = websocket.remote_address + nginx_ip, client_port = websocket.remote_address + # get real header from websocket + client_ip = websocket.headers.get("X-Real-IP") logger.debug(f"{client_ip}:{client_port} >>> new client") if client_ip in shared_data.blocked_ips: