Files
invyone/frontend/lib/tenant/subdomain.ts
T
gbpark 2431451cef
Build & Deploy to K8s / build-and-deploy (push) Successful in 4m30s
예약 서브도메인에서 dev 제거 — 본섭 테스트 테넌트 용도 허용
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 16:11:48 +09:00

38 lines
838 B
TypeScript

/**
* 테넌트 서브도메인 헬퍼.
* 메인 사이트(solution, www, admin 등 예약어) 는 null 을 리턴해서
* TenantGuard 가 체크를 스킵하게 한다.
*
* 백엔드 provisioning 의 RESERVED_SUBDOMAINS 와 같은 값을 유지할 것.
*/
const RESERVED_MAIN = new Set([
"solution",
"www",
"admin",
"api",
"app",
"static",
"assets",
"main",
"mail",
"blog",
"test",
"staging",
"prod",
"console",
]);
export function extractTenantSubdomain(host: string): string | null {
if (!host) return null;
const cleanHost = host.split(":")[0].toLowerCase();
if (!cleanHost.endsWith(".invyone.com")) return null;
const prefix = cleanHost.substring(0, cleanHost.length - ".invyone.com".length);
if (!prefix) return null;
if (RESERVED_MAIN.has(prefix)) return null;
return prefix;
}