cool fix
This commit is contained in:
parent
da84f7b968
commit
49b8023f37
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user