From cf28822a1c7cb36983b93fc5b566449a3a01d383 Mon Sep 17 00:00:00 2001 From: Waleed Date: Wed, 18 Feb 2026 14:00:25 -0800 Subject: [PATCH] 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 --- apps/sim/next.config.ts | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 9ec7ab6feb..d9dd9809f1 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,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 + }, + ] }, }