I have my-domain.com
. I want requests to the www subdomain to redirect to the root, and all requests to redirect to https.
I have 2 S3 buckets - my-domain.com
and www.my-domain.com
(empty bucket configured to redirect to my-domain.com
)
I've set up a Cloudfront distro in front of my-domain.com
for https.
For DNS, I have an A record for my-domain.com
which is an 'alias' record pointing to the cloudfront distro. I have another A record for www.my-domain.com
which is an 'alias' record pointing to the empty www.my-domain.com
S3 redirection bucket
This results in the following redirects:
http://my-domain.com -> https://my-domain.com
http://www.my-domain.com -> https://my-domain.com
However a request to https://www.my-domain.com
does not redirect. I'm presuming this is because there is no https listener for the S3 redirection bucket. So my question is, is there a better way to do this? I really don't want to have to set up another cloudfront distro just to have this functionality but it feels to me broken if https://www does not redirect correctly.
Thanks in advance,