diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts index 11ecc272..3e704a4e 100644 --- a/apps/web/src/middleware.ts +++ b/apps/web/src/middleware.ts @@ -40,6 +40,10 @@ export default authMiddleware({ return NextResponse.redirect(new URL('/app', req.url)); } + if (!auth.userId && req.nextUrl.pathname.includes('/app')) { + return NextResponse.redirect(new URL('/', req.url)); + } + return NextResponse.next(); }, publicRoutes: [