Search code examples
amazon-web-servicesamazon-ec2amazon-cloudfrontaws-acm

Cloudfront with ec2 origin


I set AWS Cloudfront with EC2 origin but have some problems here my setting:

1.Alternate Domain Names (CNAMEs): xyz.com.

2.SSL Certificate: created by ACM.

3.Custom SSL Client Support: Clients that Support Server Name Indication (SNI).

4.Origin Domain Name is EC2 Public DNS.

5.Origin Protocol Policy: HTTP only.

6.Minimum Origin SSL Protocol: SSLv3.

7.Viewer Protocol Policy: Redirect HTTP to HTTPS.

8.Allowed HTTP Methods: GET, HEAD.

Problems:

1.when I call CloudFront Domain Name which is a3xxxxxx.cloudfront.net, it redirects to EC2 public DNS, not CNAME. Cloudfront DNS

ECS Public DNS

2.still see in my browser "your connection to this site is not secure".

3.I set Route53 to Cloudfron DNS but I got the error "too many redirect" in the browser.


Solution

  • I found the problem in behaviour part, I have to select "Use legacy cache settings" and "Cache Based on Selected Request Headers" select All because I don't want cache just need ssl.