---
title: "middleware.ts in Next.js 16 (next/middleware-to-proxy)"
description: "Next.js 16 renamed middleware to proxy (Node.js runtime); middleware is deprecated."
url: http://localhost:4173/rules/next/middleware-to-proxy
updated: 2026-11-11
---

# middleware.ts in Next.js 16

> `next/middleware-to-proxy` is a vetd rule. It flags: middleware.ts in Next.js 16. It runs on every `check`, together with the TypeScript check.

| Fact | Value |
| --- | --- |
| Rule id | `next/middleware-to-proxy` |
| Severity | warning |
| Group | Next.js 16 upgrade |
| Tags | nextjs-16 |

## Why it matters

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

## How to fix it

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

## Credit

Based on work by:

- [Next.js team](https://nextjs.org): Renamed middleware to proxy in Next.js 16 and ships a codemod for the migration.

## References

- [proxy.js](https://nextjs.org/docs/app/api-reference/file-conventions/proxy), Next.js
- [How to upgrade to version 16](https://nextjs.org/docs/app/guides/upgrading/version-16), Next.js
- [Codemods](https://nextjs.org/docs/app/guides/upgrading/codemods), Next.js
- [Next.js 16](https://nextjs.org/blog/next-16), Next.js

## Related rules

- [`next/no-amp`](http://localhost:4173/rules/next/no-amp.md)

## Get this text from vetd

MCP: call `explain` with `{ "diagnosticId": "next/middleware-to-proxy" }`. CLI: `npx vetd explain next/middleware-to-proxy`.

---

[All 92 rules](http://localhost:4173/rules.md) · Previous: [`next/parallel-route-default`](http://localhost:4173/rules/next/parallel-route-default.md) · Next: [`next/no-amp`](http://localhost:4173/rules/next/no-amp.md)
