-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware does not work in Next.js 13 when the /pages directory is removed #41995
Closed
1 task done
Labels
Comments
1 task
I ran into this as well. Had to add a |
This was referenced Nov 14, 2022
11 tasks
1 task
3 tasks
jankaifer
pushed a commit
to jankaifer/next.js
that referenced
this issue
Nov 23, 2022
Fixes vercel#41995 Closes vercel#43144 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` Co-authored-by: Bruno Nascimento <bruno.hn@icloud.com>
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Verify canary release
Provide environment information
What browser are you using? (if relevant)
106.0.5249.119
How are you deploying your application? (if relevant)
n/a
Describe the Bug
Removing the
pages
directory prevents Next.js middleware from running.Expected Behavior
The middleware should work with the new
app
directory when thepages
directory does not exist.Link to reproduction
https://github.com/jamescmartinez/nextjs13-middlware-appdir-bug
To Reproduce
npm run dev
to start the appopen http://localhost:3000/page2
to open/page2
in your browser, noting that/page2
does not redirect to/
as configured inmiddleware.ts
mkdir pages
to create an empty pages directorynpm run dev
to start the appopen http://localhost:3000/page2
to open/page2
in your browser, noting that/page2
now redirects to/
The text was updated successfully, but these errors were encountered: