Files
Niklas Mischkulnig 074262baf3 Only allow node runtime in proxy (#85139)
This PR is the initiative of deprecating the edge runtime. Proxy will
default to Node.js runtime, and will not allow runtime config. If the
users want to use the edge runtime, they should stay on the Middleware,
though we recommend starting the migration.

---------

Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-10-21 16:06:11 -07:00

12 lines
321 B
TypeScript

import { NextRequest, NextResponse } from 'next/server'
// Will not work in edge runtime
import { join } from 'path/posix'
export function proxy(request: NextRequest) {
if (request.nextUrl.pathname === join('/', 'foo')) {
return NextResponse.redirect(new URL('/', request.url))
}
return NextResponse.next()
}