Part 14 / Topic 1 of 6
The rename, confirmed two ways
The installed middleware.md reference file is one paragraph long, and its entire content is a deprecation notice:
"The
middleware.jsfile convention has been deprecated in Next.js 16 and renamed toproxy.js. All functionality remains the same — only the file and export names have changed."
The current proxy.md reference confirms the same fact from the other direction: "Starting with Next.js 16, Middleware is now called Proxy to better reflect its purpose. The functionality remains the same." Rather than take either sentence on faith, both names were actually built against this harness, back to back:
$ mv proxy.ts middleware.ts # and rename the exported function middleware
$ npm run build
...
⚠ The "middleware" file convention is deprecated. Please use "proxy" instead.
To migrate automatically, run:
npx @next/codemod@canary middleware-to-proxy .
Learn more: https://nextjs.org/docs/messages/middleware-to-proxy
...
ƒ Proxy (Middleware)
$ mv middleware.ts proxy.ts # and rename the exported function back to proxy
$ npm run build
...
(no deprecation warning at all)
...
ƒ Proxy (Middleware)
Both builds succeed, and the route table labels the result identically either way (ƒ Proxy (Middleware) — the framework's own internal name hasn't fully dropped "Middleware" even in its own build output). Only the file named and exported the old way prints a warning, naming an automatic codemod (npx @next/codemod@canary middleware-to-proxy .) to migrate a real project. This course uses proxy.ts/proxy throughout, because that's what a fresh project at this pinned version actually gets with no warning — but the stage title and this part's own filename keep saying "middleware," because that's still the universally-used name for the concept, in this course's own stage plan and in nearly everything written about Next.js before this rename. Know both names; write the new one.
Done here? The practice set for Part 14 — including the solutions — is on the part page.