Skip to content

Commit cf28822

Browse files
authored
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
1 parent 86ca984 commit cf28822

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

apps/sim/next.config.ts

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { NextConfig } from 'next'
22
import { env, getEnv, isTruthy } from './lib/core/config/env'
3-
import { isDev, isHosted } from './lib/core/config/feature-flags'
3+
import { isDev } from './lib/core/config/feature-flags'
44
import {
55
getFormEmbedCSPPolicy,
66
getMainCSPPolicy,
@@ -306,34 +306,15 @@ const nextConfig: NextConfig = {
306306
}
307307
)
308308

309-
// Only enable domain redirects for the hosted version
310-
if (isHosted) {
311-
redirects.push(
312-
{
313-
source: '/((?!api|_next|_vercel|favicon|static|ingest|.*\\..*).*)',
314-
destination: 'https://www.sim.ai/$1',
315-
permanent: true,
316-
has: [{ type: 'host' as const, value: 'simstudio.ai' }],
317-
},
318-
{
319-
source: '/((?!api|_next|_vercel|favicon|static|ingest|.*\\..*).*)',
320-
destination: 'https://www.sim.ai/$1',
321-
permanent: true,
322-
has: [{ type: 'host' as const, value: 'www.simstudio.ai' }],
323-
}
324-
)
325-
}
326-
327-
// Beluga campaign short link tracking
328-
if (isHosted) {
329-
redirects.push({
309+
return redirects
310+
},
311+
async rewrites() {
312+
return [
313+
{
330314
source: '/r/:shortCode',
331315
destination: 'https://go.trybeluga.ai/:shortCode',
332-
permanent: false,
333-
})
334-
}
335-
336-
return redirects
316+
},
317+
]
337318
},
338319
}
339320

0 commit comments

Comments
 (0)