fix(shortlink): remove isHosted guard from redirects, not available at build time on ECS (#3251)

* fix(shortlink): remove isHosted guard from redirects, not available at build time on ECS

* fix(shortlink): use rewrite instead of redirect for Beluga tracking
This commit is contained in:
Waleed
2026-02-18 14:00:25 -08:00
committed by GitHub
parent 86ca984926
commit cf28822a1c

View File

@@ -1,6 +1,6 @@
import type { NextConfig } from 'next'
import { env, getEnv, isTruthy } from './lib/core/config/env'
import { isDev, isHosted } from './lib/core/config/feature-flags'
import { isDev } from './lib/core/config/feature-flags'
import {
getFormEmbedCSPPolicy,
getMainCSPPolicy,
@@ -306,34 +306,15 @@ const nextConfig: NextConfig = {
}
)
// Only enable domain redirects for the hosted version
if (isHosted) {
redirects.push(
{
source: '/((?!api|_next|_vercel|favicon|static|ingest|.*\\..*).*)',
destination: 'https://www.sim.ai/$1',
permanent: true,
has: [{ type: 'host' as const, value: 'simstudio.ai' }],
},
{
source: '/((?!api|_next|_vercel|favicon|static|ingest|.*\\..*).*)',
destination: 'https://www.sim.ai/$1',
permanent: true,
has: [{ type: 'host' as const, value: 'www.simstudio.ai' }],
}
)
}
// Beluga campaign short link tracking
if (isHosted) {
redirects.push({
return redirects
},
async rewrites() {
return [
{
source: '/r/:shortCode',
destination: 'https://go.trybeluga.ai/:shortCode',
permanent: false,
})
}
return redirects
},
]
},
}