Files
Jiwon ChoiandGitHub cbb6811171 test: confirm that middleware may affect sitemap.xml render (#69140)
Add test to confirm that the middleware affects the sitemap path if the
matcher is misconfigured.

Following of https://github.com/vercel/next.js/pull/69136
Closes NDX-221
2024-08-22 00:44:58 +09:00

14 lines
302 B
TypeScript

import { NextResponse } from 'next/server'
export default function (request) {
if (request.nextUrl.pathname !== '/redirected') {
return NextResponse.redirect(new URL('/redirected', request.url))
}
return NextResponse.next()
}
export const config = {
matcher: ['/((?!sitemap.xml).*)'],
}