-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding middleware breaks 404 functionality on dynamic page for client side #43953
Comments
Any updates? |
might be related or duplicate of the #44293. |
+1 will be nice to have it fixed! |
Closing as duplicate of #44293. |
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. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime), Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue
https://github.com/TheMatrixan/next-bug-middleware-dynamic-page
To Reproduce
/dynamic/123
- this url should exists and should return dynamic component content -DynamicPage
/dynamic/789
- this url doesn't exist in dynamic path routes and when you go to that page, it will displayDynamicPage
instead of custom 404 page. BUT, when you refresh the page, it will display correct custom 404 page.middleware.ts
file and when you will click on link/dynamic/789
, it will display correct 404 page.Describe the Bug
By adding just empty function as a middleware, when we navigate to page that doesn't exist in static paths, next will show empty dynamic page content on client side instead of 404. When we delete middleware, Next will correctly show 404 page for page that doesn't exist.
Expected Behavior
link
/dynamic/789
should display custom 404 page on client side while navigating between pages.Which browser are you using? (if relevant)
Chrome 108.0.5359.95 (64-bits)
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: