Rename edge middleware.ts -> proxy.ts (Next 16 convention)

Next 16 deprecated the middleware file convention in favour of proxy.ts
with an exported `proxy` function. Same header-forwarding logic and
matcher; clears the build-time deprecation warning.
This commit is contained in:
Simo committed 2026-06-28 16:07:42 +02:00
1 parent 7daeccb832
commit 3e8fb794d9
1 file changed
+5 -5
+5 -5
View File
@@ -1,10 +1,10 @@
import { type NextRequest, NextResponse } from "next/server"; import { type NextRequest, NextResponse } from "next/server";
// Edge middleware: Prisma can't run here, so we only forward the request path // Edge proxy (formerly "middleware"): Prisma can't run here, so we only forward
// (so server components / the access guard can read it via headers()) and // the request path (so server components / the access guard can read it via
// normalize the real client IP. The DB-backed banned/maintenance checks happen // headers()) and normalize the real client IP. The DB-backed banned/maintenance
// in src/lib/access-guard.ts (Node runtime) from the root layout. // checks happen in src/lib/access-guard.ts (Node runtime) from the root layout.
export function middleware(req: NextRequest) { export function proxy(req: NextRequest) {
const headers = new Headers(req.headers); const headers = new Headers(req.headers);
headers.set("x-pathname", req.nextUrl.pathname); headers.set("x-pathname", req.nextUrl.pathname);
const ip = const ip =