From 49b8023f3774ee38e2edd0eb06d7a9f1b1b3cd71 Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 22 Jun 2026 23:44:51 +0200 Subject: [PATCH] cool fix --- src/middleware.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/middleware.ts b/src/middleware.ts index f2c05c6..2964296 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -12,11 +12,13 @@ function getSubdomain(req: NextRequest): string | null { const portIndex = host.indexOf(":"); const hostname = portIndex !== -1 ? host.slice(0, portIndex) : host; - if (hostname === apex || hostname === `www.${apex}`) return null; + const reserved = ["www", "coolify", "mail", "accounts", "clerk", "clk", "clk2", "clkmail"]; + + if (hostname === apex || reserved.includes(hostname) || hostname === `www.${apex}`) return null; if (hostname.endsWith(`.${apex}`)) { const sub = hostname.slice(0, hostname.length - apex.length - 1); - if (sub && sub !== "www") return sub; + if (sub && !reserved.includes(sub)) return sub; } return null;