
Next.js 16 replaced middleware.ts with proxy.ts
In Next.js 16, middleware.ts is gone. The replacement is proxy.ts at the project root, exporting a function named proxy(request) and a config.matcher, and it runs on the Node runtime rather than Edge. The matcher is read statically at build time, so it cannot reference an imported constant.

