This commit is contained in:
echo 2026-06-22 23:44:51 +02:00
parent da84f7b968
commit 49b8023f37

View File

@ -12,11 +12,13 @@ function getSubdomain(req: NextRequest): string | null {
const portIndex = host.indexOf(":"); const portIndex = host.indexOf(":");
const hostname = portIndex !== -1 ? host.slice(0, portIndex) : host; 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}`)) { if (hostname.endsWith(`.${apex}`)) {
const sub = hostname.slice(0, hostname.length - apex.length - 1); 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; return null;