From 4e04ddb52698172e97efeb7bfebba84e6cface27 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Sat, 14 Nov 2026 11:31:54 +0000 Subject: [PATCH] Gateway: log rejected connections over the per-IP limit Rejections at the WebSocket upgrade (429) were silent, so a client hammering MAX_CONNECTIONS_PER_IP left no trace. Now logged as a [ratelimit] line like the connect rate limit. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- gateway/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/gateway/src/index.ts b/gateway/src/index.ts index d67036d..d461df0 100644 --- a/gateway/src/index.ts +++ b/gateway/src/index.ts @@ -583,6 +583,7 @@ const wss = new WebSocketServer({ } const ip = clientIp(req); if (MAX_CONNECTIONS_PER_IP > 0 && (connectionsPerIp.get(ip) ?? 0) >= MAX_CONNECTIONS_PER_IP) { + console.warn(`[ratelimit] too many open connections from one IP (limit ${MAX_CONNECTIONS_PER_IP})`); return done(false, 429, "Too many connections"); } done(true);