- Newest
- Most votes
- Most comments
The issue you're experiencing with AWS Amplify's redirect and rewrite rules is related to how Amplify handles multiple domains and the limitations of its current redirect configuration system.
Amplify's redirect and rewrite rules are primarily designed to work within the context of a single domain. When you have multiple custom domains set up for an Amplify app, the redirect rules typically apply to the primary domain by default.
In your specific case, where you want to redirect from one custom domain (example.images.otherdomain.com) to a different path on another custom domain (images.otherdomain.com/images/example/), this is not directly supported by Amplify's built-in redirect rules.
To achieve the desired result, you might need to consider alternative approaches:
-
Use a custom server-side solution: Implement a custom server-side logic (e.g., using AWS Lambda@Edge with CloudFront) to handle the redirection between your custom domains.
-
Leverage CloudFront: If possible, set up a CloudFront distribution in front of your Amplify app and use CloudFront's more flexible URL rewriting capabilities.
-
Implement client-side redirects: If appropriate for your use case, you could implement JavaScript-based redirects on the client side to handle the domain-specific redirections.
-
Use separate Amplify apps: Consider creating separate Amplify apps for each custom domain if they require significantly different routing rules.
It's worth noting that while Amplify's redirect feature is powerful for many use cases, it has limitations when dealing with complex multi-domain scenarios like yours. You may want to consider submitting a feature request to the AWS Amplify team for better support of cross-domain redirects within a single Amplify app.
For now, the most reliable solution would likely involve using additional AWS services like CloudFront or Lambda@Edge to achieve the desired redirection behavior across your multiple custom domains.
Sources
I getting the 301 issue while deploy my code in the aws amplify | AWS re:Post
amplify redirect rules | AWS re:Post
AWS Amplify redirect from/to custom domain | AWS re:Post
Relevant content
- asked a month ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 10 months ago
Thanks.
How does one make a feature request to the AWS Amplify Team though?