SPB Git
426 B · 8 lines typescript
1import { NextResponse, type NextRequest } from "next/server";2/** Exposes the pathname to server components (used by the auth guard to avoid redirect loops on /admin/settings). */3export function proxy(req: NextRequest) {4  const h = new Headers(req.headers); h.set("x-pathname", req.nextUrl.pathname);5  return NextResponse.next({ request: { headers: h } });6}7export const config = { matcher: ["/admin/:path*", "/login"] };8
Files · main
Menu

Theme