From 96be3f629d1a4920a1ac606bfaf3f3db78beab06 Mon Sep 17 00:00:00 2001 From: buggyhunter <82619612+buggyhunter@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:50:16 +0300 Subject: [PATCH] CTX7-272: ip address header --- src/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 49fe7ed..d4579bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -49,14 +49,12 @@ const sseTransports: Record = {}; function getClientIp(req: IncomingMessage): string | undefined { // Check both possible header casings - const forwardedFor = - req.headers["x-forwarded-for"] || - req.headers["X-Forwarded-For"]; + const forwardedFor = req.headers["x-forwarded-for"] || req.headers["X-Forwarded-For"]; if (forwardedFor) { // X-Forwarded-For can contain multiple IPs const ips = Array.isArray(forwardedFor) ? forwardedFor[0] : forwardedFor; - const ipList = ips.split(",").map(ip => ip.trim()); + const ipList = ips.split(",").map((ip) => ip.trim()); // Find the first public IP address for (const ip of ipList) {