AWS - Have https endpoints for both www and non-www endpoints using Route53, ACM, Cloudfront

amazon-cloudfront, amazon-route53, amazon-web-services, aws-certificate-manager, ssl

Solution

Create a new ACM request for `your-domain.com` and `www.your-domain.com` (and better yet, `*.your-domain.com`).

Use the newly created certificate (after verification) on your CloudFront instance.

The redirection from `https://www.domain.com` to `https://domain.com` will work after you have a valid certificate for both domains.

Problem

I have a static webpage on AWS S3 with Cloudfront. Cloudfront is setup with ACM (AWS Certificate Manager) and am using Route 53 with it. How can I have both the `www.my-endpoint.com` and `my-endpoint.com` endpoints secure with `https`? Here are some details: - My ACM certificate is setup for just `my-endpoint.com` and is attached to the Cloudfront distribution - I have a Cloudfront A Records for `my-endpoint.com` whose alias points to Cloudfront - My `www.my-endpoint.com` is configured so its alias is `my-endpoint.com` When I navigate to `https://www.my-endpoint.com` chrome complains of a potential security risk whereas the `https://my-endpoint.com` is fine.

Original source