The redirect that let them in
Your sends signed-out visitors to the login page. A security advisory says one extra header can skip middleware entirely.
This answers: Is middleware enough to protect my pages? No coding needed. 2 quick decisions.
- Who may see what
- Who is signed in
Checking your access…
Is middleware enough to protect my pages?
No. is a useful place for redirects, but it is a single layer, and framework bugs have allowed requests to skip it. Check authorization again wherever data is read: in server pages, route handlers and database rules. Keep your framework patched.
Breaks at Your server: Proxy skipped; nothing else checks
Why AI tools write this bug
Templates often put the only sign-in check in because it protects every route with a few lines of code.
How to fix it
- Check access in each server page and .
3 more steps, and a prompt that checks your own app for this bug. Part of Pro.
UnlockCommon questions
- What was the Next.js middleware vulnerability?
- CVE-2025-29927 let a crafted header skip middleware, exposing apps whose only auth check lived there. It is fixed in patched versions.