mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Add a `middleware.mdx` deprecation stub to the app-router file conventions docs so that searching for `*middleware*` in the bundled docs returns a result. - `docs/01-app/03-api-reference/03-file-conventions/middleware.mdx` — explains the v16 rename and links to the `proxy.js` API reference, including the codemod command. ### Why? The `middleware.ts` convention was renamed to `proxy.ts` in v16, but "middleware" remains the widely understood term. Searching `node_modules/next/dist/docs/01-app` for any file named `*middleware*` currently returns zero results, which is confusing for both human developers and AI coding agents that look up documentation by concept name. This stub ensures the term "middleware" is discoverable and immediately points users to the correct `proxy` docs. ### How? One new `.mdx` file — no changes to existing files. The `copy_docs` build task already globs `**/*` and renames `.mdx` → `.md`, so it will automatically appear as `middleware.md` in `dist/docs/` on the next build. ## PR checklist (Fixing a bug) - This is a docs-only change, no code or tests affected. - See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors should have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md
22 lines
814 B
Plaintext
22 lines
814 B
Plaintext
---
|
|
title: middleware.js
|
|
description: API reference for the middleware.js file (deprecated, renamed to proxy.js).
|
|
version: draft
|
|
related:
|
|
title: Learn more about Proxy
|
|
links:
|
|
- app/api-reference/file-conventions/proxy
|
|
---
|
|
|
|
The `middleware.js` file convention has been **deprecated** in Next.js 16 and renamed to [`proxy.js`](/docs/app/api-reference/file-conventions/proxy).
|
|
|
|
All functionality remains the same — only the file and export names have changed. See the [Migration to Proxy](/docs/app/api-reference/file-conventions/proxy#migration-to-proxy) section for details on how to migrate.
|
|
|
|
You can automatically migrate by running:
|
|
|
|
```bash
|
|
npx @next/codemod@canary middleware-to-proxy .
|
|
```
|
|
|
|
For full documentation, see the [`proxy.js` API reference](/docs/app/api-reference/file-conventions/proxy).
|