Skip to content
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

Redirect strips query params #2967

Closed
4 tasks done
DevPowers opened this issue Sep 5, 2022 · 5 comments
Closed
4 tasks done

Redirect strips query params #2967

DevPowers opened this issue Sep 5, 2022 · 5 comments
Labels
archived This issue has been locked. question Further information is requested redirects

Comments

@DevPowers
Copy link

Before opening, please confirm:

App Id

d1op66f9k171p6

Region

us-east-1

Amplify Hosting feature

Redirects

Describe the bug

  1. When navigating to my website via the URL:
    'example.com?query1=query1' domain is redirected -> 'www.example.com' stripping the query params

Expected behavior

  1. When navigating to my website via the URL:
    'example.com?query1=query1' domain is redirected -> 'www.example.com?query1=query1'

  2. 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

  1. 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

@davidaugustus-focusmate

My team is having this same issue.

The workaround detailed here doesn't seem to work for us:
#886 (comment)

I've added a redirect for https://mydomain.io/<*> to https://www.mydomain.io/<*> but it doesn't seem to make a difference.

@ghost ghost self-assigned this Sep 21, 2022
@ghost ghost added bug Something isn't working redirects labels Sep 21, 2022
@ghost ghost added question Further information is requested and removed bug Something isn't working labels Oct 3, 2022
@ghost
Copy link

ghost commented Oct 3, 2022

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

@ghost
Copy link

ghost commented Oct 4, 2022

Closing as a duplicate of #97

@ghost ghost closed this as completed Oct 4, 2022
@github-actions
Copy link

github-actions bot commented Oct 4, 2022

⚠️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.

@github-actions
Copy link

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.

@github-actions github-actions bot added the archived This issue has been locked. label Oct 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2022
@swaminator swaminator reopened this Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. question Further information is requested redirects
Projects
None yet
Development

No branches or pull requests

4 participants