-
Notifications
You must be signed in to change notification settings - Fork 151
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
nextjs redirects strip query parameters #296
Comments
Hi, thanks for the detailed report! |
Hi, I had a look at this issue and from what I've been able to gather so far: By default nextjs redirects URLs with trailing slash to non-trailing slash counterpart This means the first entry in the routes list generated by
Which causes the Location header for the redirect to be set sans query params at
Similarly any redirect added to
Both of which cause a similar query param loss due to the current Currently, I've been adding the query param back to the location header as a workaround for this issue but not sure if this is the best way to go about it since it likely defeats some of the performance enhancement logic provided by this package?
|
Took a look at how Vercel handles it and it seems like they always append the original search params to the
What's interesting here ist that Vercel does not cache the response although 308 is a permanent redirect. So I would vote to use the same solution for our implementation:
|
This has now been fixed in |
It seems query parameters are being stripped off the URL when using nextjs redirects.
If you add something like this to the
next.config.js
Then test running nextjs in development mode it passes the query parameters along as per the documentation:
Then deploy via tf-next and test:
Same if we use the
:path*
redirect. Locally in nextjs:and no query string when deployed via tf-next:
The text was updated successfully, but these errors were encountered: