Redirect that could work for any query string?

0

{
"source": "/old/path?<qry>",
"target": "/new/path/?<qry>",
"status": "301",
"condition": null
}

Why doesn't this work?

Edited by: WD40erik on Jul 9, 2019 6:57 PM

질문됨 5년 전524회 조회
2개 답변
0
수락된 답변

The redirect query string can contain multiple parameters but cannot be formatted as a single string param like you've listed there. Additionally, the target currently only supports path based URL's when using query strings (like those used with SPA routing frameworks, aka react-router, angular-router, etc).

The following are valid redirects (the names are arbitrary):

/docs?id=<idValue>
/documents/<idValue>

/docs?id=<idValue>&nextId=<nextIdValue>&finalId=<finalIdValue>
/documents/<idValue>/<nextIdValue>/<finalIdValue>

etc...

Note that if any target is not a valid path within your app, the default redirect rule will redirect all invalid requests back to root.

답변함 5년 전
0

Hi WD40erik,

I have the same issue with multiple environments using GitFlow.

We have qa.example.com and dev.example.com with zero code changes between the two. However, qa.example.com was deployed 3 days before dev.example.com and qa works as I expect.

When navigating to /dashboard and /dashboard/, with or without a trailing slash on qa it works fine and renders the page. If you navigate to the dev subdomain without a trailing slash, /dashboard it redirects to /dashboard/ with the appended trailing slash and removes any query parameters.

This is super frustrating as there are no differences between the codebases and there are no rewrites and redirects rules set for the app. My only guess is that AWS Amplify Console changed its default routing/redirects within the past week or so. Hence qa subdomain was not affected, since it was deployed a few days earlier, and dev subdomain was affected by some Amplify Console code change.

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠