Rename middleware.ts to proxy.ts and export as proxy function

This commit is contained in:
2026-03-02 14:39:56 -05:00
parent f94ceaf233
commit 076108d82a
+16
View File
@@ -0,0 +1,16 @@
import { getSessionCookie } from "better-auth/cookies";
import { type NextRequest, NextResponse } from "next/server";
export function proxy(request: NextRequest) {
const sessionCookie = getSessionCookie(request);
if (!sessionCookie) {
return NextResponse.redirect(new URL("/login", request.url));
}
return NextResponse.next();
}
export const config = {
matcher: ["/dashboard", "/explore", "/settings", "/setup", "/titles/:path*"],
};