Use a lightweight cookie (multica_logged_in) + Next.js 16 proxy to 302-redirect authenticated users visiting / straight to /issues. Unauthenticated visitors (and search engine crawlers) continue to see the full landing page with zero flash. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
14 lines
367 B
TypeScript
14 lines
367 B
TypeScript
import { NextResponse } from "next/server";
|
|
import type { NextRequest } from "next/server";
|
|
|
|
export function proxy(request: NextRequest) {
|
|
const loggedIn = request.cookies.has("multica_logged_in");
|
|
if (loggedIn) {
|
|
return NextResponse.redirect(new URL("/issues", request.url));
|
|
}
|
|
return NextResponse.next();
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ["/"],
|
|
};
|