-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Inconsistent value for context.resolvedUrl in getServerSideProps #22558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issu 8000 e 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
Comments
To give some more context about how we found this bug and why is important to us: We have a custom But because of this bug we can't have the full resolvedUrl (including all route params) when doing server-side navigation. A simple use case for this are email notifications, where we include direct links to private areas of our site, and the user should be able to click the link, login and then get redirected back to the content. Another use case would be just sharing URLs of private pages with other users. |
Just confirmed this is still happening in the final |
I can confirm the problem is still present in versions |
I can confirm the problem is still present in the current version |
Problem is still present in version v11.1.2 |
Same here with version v11.1.2 |
I was experiencing this same issue on v11.1.4 and just updated to v12.1.6 today and it appears to be resolved there. |
This is a fork of the original repo case using v12.1.6 and the problem unfortunately still exists: https://codesandbox.io/s/cocky-poincare-0896ul
|
I had a similar issue with 12.1.5, resolvedUrl was including url and segments after navigating in |
I confirm the problem still present in the version |
this caught us out too today, landing us a redirect loop :S |
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you. |
This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding! |
Uh oh!
There was an error while loading. Please reload this page.
What version of Next.js are you using?
v10.0.8
(probably happening in earlier versions)What version of Node.js are you using?
v12.18.3 (should be replicable in any)
What browser are you using?
Any
What operating system are you using?
Any
How are you deploying your application?
next start
Describe the Bug
When using
rewrites
without file-system based routing (useFileSystemPublicRoutes: false
), the value forcontext.resolvedUrl
ongetServerSideProps
lacks the query parameters when navigating server side (full page load).Expected Behavior
context.resolvedUrl
should return the same value when navigating client side or server side.To Reproduce
I've created a codesandbox to reproduce the issue:
https://codesandbox.io/s/musing-lederberg-zuexy
This codesandbox has a next.config.js that disables file-sytem routing, and defines the following rewriting rules:
To reproduce the bug:
context.resesolvedUrl
=/items/itemview?slug=fancy-thing-1
, i.e. it includes theslug
paramslug
param is now missing fromcontext.resolvedUrl
The text was updated successfully, but these errors were encountered: