fix(frontend): env-driven marketing host detection
Exact-match on 'corrosionmgmt.com' meant www. or any staging host silently served the panel instead of the marketing site. Hosts now come from VITE_MARKETING_HOSTS (comma-separated, defaults cover bare + www). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,15 @@ declare module 'vue-router' {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Domain detection — runs once at module load
|
||||
// Env-driven so www./staging hosts route correctly; an exact-match literal
|
||||
// here once meant any non-canonical marketing host silently got the panel.
|
||||
// ---------------------------------------------------------------------------
|
||||
const hostname = typeof window !== 'undefined' ? window.location.hostname : ''
|
||||
const isMarketingDomain = hostname === 'corrosionmgmt.com'
|
||||
const marketingHosts = (import.meta.env.VITE_MARKETING_HOSTS ?? 'corrosionmgmt.com,www.corrosionmgmt.com')
|
||||
.split(',')
|
||||
.map((h: string) => h.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
const isMarketingDomain = marketingHosts.includes(hostname.toLowerCase())
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Marketing page children — shared between both domain route sets
|
||||
|
||||
Reference in New Issue
Block a user