Context
Next.js 16 renamed the middleware.ts file convention to proxy.ts. The old name still works but logs a deprecation warning on every build/dev start:
⚠ The "middleware" file convention is deprecated. Please use "proxy" instead.
Reference: https://nextjs.org/docs/messages/middleware-to-proxy
Why Next.js renamed it
"Middleware" was confused with Express middleware. "Proxy" clarifies it's a network-level interceptor running at the edge, in front of the app. Next.js is discouraging overuse and plans to provide better alternatives for common use cases.
The migration is a simple rename — the NextRequest/NextResponse API is unchanged:
- // middleware.ts
- export function middleware(req: NextRequest) { ... }
+ // proxy.ts
+ export function proxy(req: NextRequest) { ... }
Codemod available: npx @next/codemod@canary middleware-to-proxy .
What needs to change in @sentinel-auth/nextjs
@sentinel-auth/nextjs/authz-middleware exports createSentinelAuthzMiddleware() which returns a function for the middleware convention.
Suggested changes:
- Add
@sentinel-auth/nextjs/authz-proxy export path (or rename existing)
- Return function should be compatible with the
proxy convention name
- Update docs/examples to show
proxy.ts usage
- Optionally keep the old export as a deprecated alias for backwards compat
Severity
Low — deprecation warning only. Apps work fine with middleware.ts today. But the old convention will likely be removed in Next.js 17+.
Discovered in
Chem-Vault2 frontend (S06) using @sentinel-auth/nextjs@0.10.2 + Next.js 16.2.2
Context
Next.js 16 renamed the
middleware.tsfile convention toproxy.ts. The old name still works but logs a deprecation warning on every build/dev start:Reference: https://nextjs.org/docs/messages/middleware-to-proxy
Why Next.js renamed it
"Middleware" was confused with Express middleware. "Proxy" clarifies it's a network-level interceptor running at the edge, in front of the app. Next.js is discouraging overuse and plans to provide better alternatives for common use cases.
The migration is a simple rename — the
NextRequest/NextResponseAPI is unchanged:Codemod available:
npx @next/codemod@canary middleware-to-proxy .What needs to change in @sentinel-auth/nextjs
@sentinel-auth/nextjs/authz-middlewareexportscreateSentinelAuthzMiddleware()which returns a function for themiddlewareconvention.Suggested changes:
@sentinel-auth/nextjs/authz-proxyexport path (or rename existing)proxyconvention nameproxy.tsusageSeverity
Low — deprecation warning only. Apps work fine with
middleware.tstoday. But the old convention will likely be removed in Next.js 17+.Discovered in
Chem-Vault2 frontend (S06) using
@sentinel-auth/nextjs@0.10.2+ Next.js 16.2.2