middleware.ts in Next.js 16

next/middleware-to-proxywarningnextjs-16

Why it matters

Next.js 16 renamed middleware to proxy (Node.js runtime); middleware is deprecated.

Fix

Rename middleware.ts to proxy.ts and the exported function to proxy (the codemod does both).

Credit

  • From the Next.js team

    Renamed middleware to proxy in Next.js 16 and ships a codemod for the migration.

References