From b4e506064904d924f5e9fc779175006ad7e8430d Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 18 Feb 2026 13:49:30 -0800 Subject: [PATCH 1/2] fix(shortlink): remove isHosted guard from redirects, not available at build time on ECS --- apps/sim/next.config.ts | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 9ec7ab6feb..d3b37d34f2 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -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,32 +306,12 @@ 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({ - source: '/r/:shortCode', - destination: 'https://go.trybeluga.ai/:shortCode', - permanent: false, - }) - } + // Beluga campaign short link tracking (always registered — harmless for self-hosted) + redirects.push({ + source: '/r/:shortCode', + destination: 'https://go.trybeluga.ai/:shortCode', + permanent: false, + }) return redirects }, From 4eda1ec00e733c9ea310cd1f6465cc1c39b29f3d Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 18 Feb 2026 13:51:58 -0800 Subject: [PATCH 2/2] fix(shortlink): use rewrite instead of redirect for Beluga tracking --- apps/sim/next.config.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index d3b37d34f2..d9dd9809f1 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -306,15 +306,16 @@ const nextConfig: NextConfig = { } ) - // Beluga campaign short link tracking (always registered — harmless for self-hosted) - redirects.push({ - source: '/r/:shortCode', - destination: 'https://go.trybeluga.ai/:shortCode', - permanent: false, - }) - return redirects }, + async rewrites() { + return [ + { + source: '/r/:shortCode', + destination: 'https://go.trybeluga.ai/:shortCode', + }, + ] + }, } export default nextConfig