-
Notifications
You must be signed in to change notification settings - Fork 116
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
When Redirecting From/To URLs With Trailing Slash, URL Query Doesn't Persist #3374
Comments
Is there any progress on this issue? |
Has there been any progress on this issue? |
This issue doesn't occur with next.js ssr apps. |
@anatolzak 👋 , we have shipped a fix for this behavior and this issue should no longer occur. Thanks for your continued patience! |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Before opening, please confirm:
App Id
d2d2aijy8ye0g3
AWS Region
us-east-1
Amplify Hosting feature
Redirects
Describe the bug
I have deployed a simple Next.js app to AWS Amplify from the following repo: https://github.com/anatolzak/nextjs-query-example
When I go to any page (except the index page) without a trailing slash and add url query params, it redirects me to the url with a trailing slash but drops my url query.
So if I go to:
https://main.d2d2aijy8ye0g3.amplifyapp.com/test?query_1=true
, it redirects me tohttps://main.d2d2aijy8ye0g3.amplifyapp.com/test/
In my
next.config.js
, I settrailingSlash
totrue
so it redirects urls without a trailing slash to their counterpart with a trailing slash.Without setting
trailingSlash
totrue
in Next.js apps, urls with a trailing slash produce 403 status code which is another issue #3373, but I am sure that if AWS Amplify redirected you from urls with a trailing slash to without a trailing slash, which is the default expected behavior for Next.js apps, I am sure AWS Amplify would still drop the query param as described above.I can also confirm it happens with Gatsby apps as well, where they default to redirecting urls without a trailing slash to their counterpart with a trailing slash, but AWS Amplify drops the query params during the redirect as well.
But when using Vercel for both Gatsby and Next.js apps, it never drops query params when redirecting to/from urls with a trailing slash.
Expected behavior
When redirecting to/from urls with a trailing slash, url query should persist and not be deleted after the redirect.
Reproduction steps
/test?query=1
, and it will redirect to/test/
Build Settings
No response
Log output
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: