Not in pages folder and you need to place middleware.ts to src NextJS middleware does not seem to be triggeredI 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 "https://stackoverflow.com/questions/73040090/nextjs-middleware-does-not-seem-to-be-triggered[Next.js] API 사용해서 로그인 구현 / middleware 적용[Next.js] middleware + api 로그인 구현https://velog.io/@sssssssssy/Next.js-13ver-에서-로그인-유지하기Routing: MiddlewareLearn how to use Middleware to run code before a request is completed.https://nextjs.org/docs/pages/building-your-application/routing/middleware