Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 47 additions & 5 deletions apps/sim/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ const minimalRegistryAlias: Record<string, string> = useMinimalRegistry
}
: {}

/**
* Marketing routes (`app/(landing)/**`, plus the root) exempted from COEP.
*
* COEP is a *document* header and is inherited across client-side `<Link>`
* navigations, so `/demo`'s own exemption only applies on a direct load. Any
* landing page left isolated soft-navigates into `/demo` still credentialless,
* where the Cal.com booker iframe loads uncredentialed and hangs forever.
* Every route under `app/(landing)` must be listed here.
*/
const LANDING_ROUTES = [
'blog',
'careers',
'changelog',
'comparisons',
'contact',
'demo',
'enterprise',
'files',
'integrations',
'knowledge',
'library',
'logs',
'models',
'pricing',
'privacy',
'scheduled-tasks',
'solutions',
'tables',
'terms',
'workflows',
] as const

const nextConfig: NextConfig = {
devIndicators: false,
poweredByHeader: false,
Expand Down Expand Up @@ -255,20 +287,30 @@ const nextConfig: NextConfig = {
],
},
{
// Exclude Vercel internal resources and static assets from strict COEP, Google Drive Picker
// Exclude Vercel internal resources and static assets from strict COOP, Google Drive Picker
// and the /demo Cal.com booking embed to prevent 'refused to connect' / slow-load issues
source: '/((?!_next|_vercel|api|favicon.ico|w/.*|workspace/.*|api/tools/drive|demo).*)',
headers: [
{
key: 'Cross-Origin-Embedder-Policy',
value: 'credentialless',
},
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
],
},
{
// COEP stays on by default - a new route is cross-origin isolated unless
// it is named here. The exemptions are the app surfaces that embed
// credentialed third parties (Drive Picker, Vercel resources) and the
// marketing surface, which must opt out wholesale: see LANDING_ROUTES.
// The trailing `|$` exempts the root path.
source: `/((?!_next|_vercel|api|favicon.ico|w/.*|workspace/.*|api/tools/drive|${LANDING_ROUTES.join('|')}|$).*)`,
headers: [
{
key: 'Cross-Origin-Embedder-Policy',
value: 'credentialless',
},
],
},
{
// For main app routes, Google Drive Picker, the /demo Cal.com embed, and Vercel resources - use permissive policies
source: '/(w/.*|workspace/.*|api/tools/drive|demo.*|_next/.*|_vercel/.*)',
Expand Down
Loading