Amplify: redirect based on environment

0

Hello, I'm discovering AWS Amplify and I'm surprised that it is not possible yet to write redirects based on the environment.

For example, I'd like that the path /authors - on https://example-dev.website.com in dev env, and https://example.website.com in production env - redirects with a 301 to https://authors-dev.website.com in dev env, and https://authors.website.com in production.

That way I'd end up with the following redirect in dev:

  {
    "source": "/authors",
    "target": "https://authors-dev.website.com",
    "status": "301",
    "condition": null
  },

How to manage the prod redirect without having to duplicate the whole project?

1개 답변
0

Hello,

Thank you for reaching out to us.

Amplify currently doesn't support environment-based redirects. For reverse-proxy redirect, it only support source addresses of paths.

Only Options are to create a new Amplify app for the environment or create your own CloudFront distribution pointing to each of the Amplify CloudFront distributions that handles the redirect for them. Please refer to this link [1] for more information

References:

  1. https://github.com/aws-amplify/amplify-console/issues/8
AWS
지원 엔지니어
답변함 2년 전

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

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

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

관련 콘텐츠