Skip to content

Commit ef00750

Browse files
fix(demo): exempt landing routes from COEP so the Cal.com booker loads on soft nav (#6110)
1 parent 9e9dc54 commit ef00750

1 file changed

Lines changed: 47 additions & 5 deletions

File tree

apps/sim/next.config.ts

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,38 @@ const minimalRegistryAlias: Record<string, string> = useMinimalRegistry
3636
}
3737
: {}
3838

39+
/**
40+
* Marketing routes (`app/(landing)/**`, plus the root) exempted from COEP.
41+
*
42+
* COEP is a *document* header and is inherited across client-side `<Link>`
43+
* navigations, so `/demo`'s own exemption only applies on a direct load. Any
44+
* landing page left isolated soft-navigates into `/demo` still credentialless,
45+
* where the Cal.com booker iframe loads uncredentialed and hangs forever.
46+
* Every route under `app/(landing)` must be listed here.
47+
*/
48+
const LANDING_ROUTES = [
49+
'blog',
50+
'careers',
51+
'changelog',
52+
'comparisons',
53+
'contact',
54+
'demo',
55+
'enterprise',
56+
'files',
57+
'integrations',
58+
'knowledge',
59+
'library',
60+
'logs',
61+
'models',
62+
'pricing',
63+
'privacy',
64+
'scheduled-tasks',
65+
'solutions',
66+
'tables',
67+
'terms',
68+
'workflows',
69+
] as const
70+
3971
const nextConfig: NextConfig = {
4072
devIndicators: false,
4173
poweredByHeader: false,
@@ -255,20 +287,30 @@ const nextConfig: NextConfig = {
255287
],
256288
},
257289
{
258-
// Exclude Vercel internal resources and static assets from strict COEP, Google Drive Picker
290+
// Exclude Vercel internal resources and static assets from strict COOP, Google Drive Picker
259291
// and the /demo Cal.com booking embed to prevent 'refused to connect' / slow-load issues
260292
source: '/((?!_next|_vercel|api|favicon.ico|w/.*|workspace/.*|api/tools/drive|demo).*)',
261293
headers: [
262-
{
263-
key: 'Cross-Origin-Embedder-Policy',
264-
value: 'credentialless',
265-
},
266294
{
267295
key: 'Cross-Origin-Opener-Policy',
268296
value: 'same-origin',
269297
},
270298
],
271299
},
300+
{
301+
// COEP stays on by default - a new route is cross-origin isolated unless
302+
// it is named here. The exemptions are the app surfaces that embed
303+
// credentialed third parties (Drive Picker, Vercel resources) and the
304+
// marketing surface, which must opt out wholesale: see LANDING_ROUTES.
305+
// The trailing `|$` exempts the root path.
306+
source: `/((?!_next|_vercel|api|favicon.ico|w/.*|workspace/.*|api/tools/drive|${LANDING_ROUTES.join('|')}|$).*)`,
307+
headers: [
308+
{
309+
key: 'Cross-Origin-Embedder-Policy',
310+
value: 'credentialless',
311+
},
312+
],
313+
},
272314
{
273315
// For main app routes, Google Drive Picker, the /demo Cal.com embed, and Vercel resources - use permissive policies
274316
source: '/(w/.*|workspace/.*|api/tools/drive|demo.*|_next/.*|_vercel/.*)',

0 commit comments

Comments
 (0)