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
[Next-9.5.4] Rewrites URLs are not masked properly and instead interpolated. #17810
Comments
This doesn't seem to be expected 🤔 the rewrites feature isn't meant to map the dynamic route like this and instead should have the full URL already provided. The dynamic route interpolation is a client-side feature as shown in the docs here https://nextjs.org/docs/routing/introduction#linking-to-dynamic-paths The above rewrite should be something like this instead:
If you're using unconventional routing like this |
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
Hi, I have a rewrite in my app for rewriting a slug based url to legacy id based urls like:
Before Next 9.5.3, I was using router.push like this to navigate to slug based URL:
It works fine on 9.5.3 as well.
But, after moving to 9.5.4, the above rewrite gets interpolated and the URL on browser is displayed like:
/page/123/456?slug=some-blog
instead of/blog/some-blog
.Is there another way to navigate to
/blog/some-blog
? Or is it an issue with the interpolate?Regression PR: #16774
Line which causes this: https://github.com/vercel/next.js/pull/16774/files#diff-5eff10c96fa6858c659318492c4cf7f7R637
To Reproduce
I have created two codesandbox, one with 9.5.2 and one with 9.5.4 to show the behavior:
Next 9.5.4
/page/123/456?slug=some-blog
Expected behavior
/blog/some-blog
System information
The text was updated successfully, but these errors were encountered: