This commit is contained in:
Timo Knuth
2026-02-27 15:19:24 +01:00
parent b7f8221095
commit 253c3c1c6d
134 changed files with 11188 additions and 1871 deletions

View File

@@ -0,0 +1,20 @@
import { headers } from 'next/headers'
const RESERVED_SUBDOMAINS = ['www', 'app', 'admin', 'localhost', 'superadmin', 'api']
export async function getTenantSlug() {
const host = (await headers()).get('host') || ''
const domainParts = host.split(':')[0].split('.')
if (
domainParts.length > 2 ||
(domainParts.length === 2 && domainParts[1] === 'localhost')
) {
const slug = domainParts[0]
if (!RESERVED_SUBDOMAINS.includes(slug)) {
return slug
}
}
return null
}