Dev Flow
NextJS middleware does not seem to be triggered
asked 7 months agoAsked
0Answers
3Views
I have the middleware.js
file within /myproject/pages/middleware.js
:
export function middleware(request) {
console.log(1)
return NextResponse.redirect(new URL('/', request.url))
}
// See "Matching Paths" below to learn more
export const config = {
matcher: ['/test'],
}
Now what I expect is when i go to the page /test
then it should redirect me to /
. However nothing happens and I see my standard 404 page.