Next.js 16 swaps middleware.ts for proxy.ts, and it's not just a rename. The export shape changes (a default export named proxy instead of a named middleware function), and the default runtime flips from Edge to Node.js.
That runtime change is where things get interesting. A handful of Edge-runtime-specific patterns don't automatically carry over cleanly: request.geo, request.ip, an explicit runtime: 'edge' config, streamed Response objects, and WASM imports. None of these break the migration outright, but each one is worth testing under Node.js before you ship.
The mechanical part, rewriting the export and renaming arrow-function exports that can't be default-exported in place, is easy to get wrong by hand across a big file. I built a small browser tool, MiddlewareToProxy, that does the rewrite, shows a side-by-side diff, and flags every risky pattern line by line so you're not hunting for them manually.
It's meant to complement the official @next/codemod, not replace it: use the codemod for the full project upgrade, use this for previewing a single file or writing up a migration PR first.
Full walkthrough and the tool itself here: https://devencyclopedia.com/tools/middleware-to-proxy
Top comments (0)