mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
bc59f210b0
This PR removes middleware docs and adds a "Migration to Proxy" section to the Proxy docs, which explains the rationale for the renaming to Proxy and provides a migration guide. Did not remove `middleware-upgrade-docs` as it's an upgrade doc from the legacy middleware. Below are untouched as they need codebase changes: - `instrumentation` docs - `onRequestError` has `context.routeType` as `'middleware'` - `adapterPath` docs - has `MiddlewareMatcher` type example - `ProxyConfig` - has a user-facing `MiddlewareMatcher` type --------- Co-authored-by: Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
19 lines
618 B
Plaintext
19 lines
618 B
Plaintext
---
|
|
title: '`NextResponse.next()` used in a Route Handler in the App Router'
|
|
---
|
|
|
|
## Why This Error Occurred
|
|
|
|
Route Handlers in the Next.js App Router do not support using the `NextResponse.next()` method to forward to the next Proxy.
|
|
|
|
The Route Handler is considered the end of the proxy "chain". Handlers must always return a `Response` object instead.
|
|
|
|
## Possible Ways to Fix It
|
|
|
|
Remove the `NextResponse.next()` and replace it with a correct response handler.
|
|
|
|
## Useful Links
|
|
|
|
- [Route Handlers](/docs/app/api-reference/file-conventions/route)
|
|
- [`NextResponse`](/docs/app/api-reference/functions/next-response)
|