-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Rewrites bug when using with basePath and public directory #16332
Comments
Next.js dev server behaves as expected. After running
It fails only if the server is running in non-development mode. |
After some investigation, I found the current matching order of Routes always puts public routes which is in From this Although I am not fully aware of the context of this decision, but I suppose the assumption of public routes and the early routing failure conflicts with each other. We might:
Which direction should we take further? |
Opened a PR with the first solution. Hope this helps. Thanks! |
This corrects the basePath being required check for filesystem routes to not consider the public folder catch-all route since it always matches even if the public file isn't present and instead moves the basePath check inside of the public-folder catch-all. Tests already exist that catch this by adding a public folder to the existing `basepath` test suite Fixes: #16332 Closes: #16350
This corrects the basePath being required check for filesystem routes to not consider the public folder catch-all route since it always matches even if the public file isn't present and instead moves the basePath check inside of the public-folder catch-all. Tests already exist that catch this by adding a public folder to the existing `basepath` test suite Fixes: vercel#16332 Closes: vercel#16350
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Next.js cannot rewrites URL when using
basePath
option and havingpublic
directory.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
curl 'http://localhost:3000/todos'
Expected behavior
$ curl 'http://localhost:3000/todos' HTTP/1.1 200 OK ...
System information
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: