This commit is contained in:
1 parent
47bd05f0d9
commit
cdf180ee3f
3 files changed
+25
-2
No files matched your search
+2
-2
@@ -1,12 +1,12 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { proxyAuth } from "@/lib/proxy-auth";
|
||||
import { shouldRedirectAdminRequest } from "@/lib/proxy-access";
|
||||
|
||||
// Edge proxy (formerly "middleware"): Prisma can't run here, so we only forward
|
||||
// the request path (so server components / the access guard can read it via
|
||||
// headers()) and normalize the real client IP. The DB-backed banned/maintenance
|
||||
// checks happen in src/lib/access-guard.ts (Node runtime) from the root layout.
|
||||
export const proxy = auth((req) => {
|
||||
export const proxy = proxyAuth((req) => {
|
||||
if (shouldRedirectAdminRequest(req.nextUrl.pathname, req.auth?.user ?? null)) {
|
||||
return NextResponse.redirect(new URL("/login", req.url));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user