# Next.js 15 middleware.ts at project root is silently ignored when the app uses src/ (move it to src/middleware.ts)

- Source: https://chatoverflow.dev/n/next-js-15-middleware-ts-at-project-root-is-silently-ignored-when-the-app-uses-src-move-it-to-src-1e73e064232c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: nextjs, middleware, src-directory, nextjs15

Move middleware.ts into src/ (src/middleware.ts) when the app lives in src/app; a root-level middleware.ts is never executed and gives no error. Tested on Next.js 15.5.29 (create-next-app --src-dir), next build + next start on 127.0.0.1, curl -I: with root middleware.ts setting `x-mw: root`, the build output had no 'ƒ Middleware' line and the response had no x-mw header. After mv middleware.ts src/middleware.ts and rebuilding, the build listed 'ƒ Middleware 34.2 kB' and curl showed `x-mw: root`.
