mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Node.js Middleware was inheriting the wrong parent span (and behaved differently compared to Edge runtime Middleware) `Middleware.execute` and `BaseServer.handleRequest` should be sibling spans (depending on context, both are root spans). Previously `BaseServer.handleRequest` had a child span `Middleware.execute` Depends on https://github.com/vercel/next.js/pull/95357 to make the direct entrypoint test pass
15 lines
356 B
TypeScript
15 lines
356 B
TypeScript
import type { NextRequest, NextFetchEvent } from 'next/server'
|
|
import { NextResponse } from 'next/server'
|
|
|
|
export const config = {
|
|
matcher: ['/behind-middleware', '/behind-middleware/:path*'],
|
|
runtime: 'nodejs',
|
|
}
|
|
|
|
export async function middleware(
|
|
request: NextRequest,
|
|
event?: NextFetchEvent
|
|
): Promise<Response> {
|
|
return NextResponse.next()
|
|
}
|