@@ -25,20 +25,21 @@ export async function middleware(request: NextRequest) {
2525 const hostname = url . hostname ;
2626 const path = url . pathname ;
2727
28- if (
29- buildEnv . NEXT_PUBLIC_IS_CAP !== "true" &&
30- ! (
31- path . startsWith ( "/s/" ) ||
32- path . startsWith ( "/dashboard" ) ||
33- path . startsWith ( "/onboarding" ) ||
34- path . startsWith ( "/api" ) ||
35- path . startsWith ( "/login" ) ||
36- path . startsWith ( "/invite" ) ||
37- path . startsWith ( "/self-hosting" ) ||
38- path . startsWith ( "/terms" )
28+ if ( buildEnv . NEXT_PUBLIC_IS_CAP !== "true" ) {
29+ if (
30+ ! (
31+ path . startsWith ( "/s/" ) ||
32+ path . startsWith ( "/dashboard" ) ||
33+ path . startsWith ( "/onboarding" ) ||
34+ path . startsWith ( "/api" ) ||
35+ path . startsWith ( "/login" ) ||
36+ path . startsWith ( "/invite" ) ||
37+ path . startsWith ( "/self-hosting" ) ||
38+ path . startsWith ( "/terms" )
39+ )
3940 )
40- ) {
41- return NextResponse . redirect ( new URL ( "/login" , url . origin ) ) ;
41+ return NextResponse . redirect ( new URL ( "/login" , url . origin ) ) ;
42+ else return NextResponse . next ( ) ;
4243 }
4344
4445 if ( mainOrigins . some ( ( d ) => url . origin . startsWith ( d ) ) ) {
@@ -54,7 +55,6 @@ export async function middleware(request: NextRequest) {
5455 if ( ! path . startsWith ( "/s/" ) ) {
5556 const url = new URL ( request . url ) ;
5657 url . hostname = webUrl ;
57- console . log ( { url } ) ;
5858 return NextResponse . redirect ( url ) ;
5959 }
6060
0 commit comments