Skip to main content

Command Palette

Search for a command to run...

Next.js middleware.ts to proxy.ts: What Changes

Next.js 16 renamed middleware.ts to proxy.ts, and it's not just a name change. Here's what the runtime switch means and how to migrate a real auth-check file.

Updated
2 min readView as Markdown
Next.js middleware.ts to proxy.ts: What Changes
D
devEncyclopedia is a developer resource for practical guides, interview prep, and IT tutorials covering Kubernetes, Next.js, NestJS, AWS, and more. Written by Zeeshan Tofiq, a full stack developer with 6+ years of production experience. devencyclopedia.com

Next.js 16 quietly renamed middleware.ts to proxy.ts, and most changelogs bury it in a single bullet point next to Cache Components and Turbopack. It deserves more attention than that, because the rename comes with a real architectural change: proxy.ts runs on the Node.js runtime by default instead of the Edge runtime middleware.ts used.

Three things change together:

  1. Filename: middleware.ts becomes proxy.ts

  2. Export: named export middleware becomes default export proxy

  3. Default runtime: Edge becomes Node.js

The runtime switch is the part worth paying attention to. Edge gave global low latency distribution but a restricted API surface, which often meant hunting for Edge compatible package forks. Node.js runtime gives proxy.ts full Node API access by default, removing most of that friction.

The good news: middleware.ts still works. It's deprecated, not removed, so nothing breaks on upgrade. Simple middleware (cookie checks, header rewrites, basic redirects) can migrate today in about five minutes. Middleware relying on Edge specific geo distribution or Edge only APIs should be benchmarked on proxy.ts in a branch before touching production traffic.

This guide walks through a real auth check example migrated step by step, a full compatibility table for what breaks under the Node.js runtime, and a free tool that rewrites your middleware file automatically.

Read the full guide:
https://devencyclopedia.com/blog/nextjs-middleware-to-proxy