Files
vercel__next.js/errors/proxy-new-signature.mdx
Jiwon Choi 71ce95dffa docs: Replace Middleware docs to Proxy (#84709)
> [!NOTE]
> Best reviewed by each commit for better diff view.

This PR clones the Middleware docs for Proxy and removes the Middleware docs.

Did not clone the list of docs:

- `errors/middleware-upgrade.mdx` - It's a middleware upgrade guide from v12.2
- `errors/beta-middleware.mdx` - It's an error when using middleware before v12.2
- `errors/returning-response-body.mdx` - Legacy behavior from versions < v12.2
2025-10-17 16:13:26 +02:00

38 lines
716 B
Plaintext

---
title: Deprecated Proxy API Signature
---
## Why This Error Occurred
Your application is using a Proxy function that is using parameters from the deprecated API.
```ts filename="proxy.ts"
import { NextResponse } from 'next/server'
export function proxy(event) {
if (event.request.nextUrl.pathname === '/blocked') {
event.respondWith(
new NextResponse(null, {
status: 403,
})
)
}
}
```
## Possible Ways to Fix It
Update to use the new API for Proxy:
```ts filename="proxy.ts"
import { NextResponse } from 'next/server'
export function proxy(request) {
if (request.nextUrl.pathname === '/blocked') {
return new NextResponse(null, {
status: 403,
})
}
}
```