amplify-hosting
amplify-hosting copied to clipboard
Redirect strips query params
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
App Id
d1op66f9k171p6
Region
us-east-1
Amplify Hosting feature
Redirects
Describe the bug
- When navigating to my website via the URL:
'example.com?query1=query1' domain is redirected -> 'www.example.com' stripping the query params
Expected behavior
-
When navigating to my website via the URL:
'example.com?query1=query1' domain is redirected -> 'www.example.com?query1=query1' -
The expected behavior works for my subdomains but not the main domain. 'subdomain.example.com?query1=query1' domain is redirected -> 'www.subdomain.example.com?query1=query1'
Reproduction steps
- I can trigger the bug by entering my domain without the WWW and query params. The result is being navigated to the WWW domain with query params stripped.
Build Settings
version: 1
frontend:
phases:
preBuild:
commands:
- npx ci
build:
commands:
- if [[("${AWS_BRANCH}" = "develop")]]; then npm run build:sandbox; fi
- if [[("${AWS_BRANCH}" = "main")]]; then npm run build:sandbox; fi
- if [[("${AWS_BRANCH}" != "main") && ("${AWS_BRANCH}" != "develop")]]; then npm run build:sandbox; fi
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
Additional information
No response
My team is having this same issue.
The workaround detailed here doesn't seem to work for us: https://github.com/aws-amplify/amplify-hosting/issues/886#issuecomment-668249281
I've added a redirect for https://mydomain.io/<*>
to https://www.mydomain.io/<*>
but it doesn't seem to make a difference.
Hi @DevPowers and @davidaugustus-focusmate 👋🏽 apologies for the delay. According to the Amplify documentation, dropping the query params is intended behavior:
If the destination address for the matching rule has query parameters, query parameters aren't forwarded. For example, if the destination address for the redirect is
https://example-target.com?q=someParam
, query parameters aren't passed through.
Please read more about implementing query params here: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html#query-parameters
Closing as a duplicate of #97
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.