I have my custom domain (file.example.com) hosted in Namecheap and DNS. Now I have AWS S3 bucket which I am trying to point to my custom domain (file.example.com). What I did is that I have set all the properties and permissions in AWS S3 bucket as well as created Cloudfront distribution to redirect my custom domain to Https. Now I can access every objects using my custom domain URL (file.example.com/sample.pdf), but the HTPPS is not working inspite of creating Cloudfront distribution and generating SSL certificate.
Question posted in Amazon Web Sevices
The official Amazon Web Services documentation can be found here.
The official Amazon Web Services documentation can be found here.
2
Answers
Redirection for HTTP to HTTPS is handled in the Behavior settings for the distribution. In your CloudFront console, open up your distribution to where you took that screenshot. At the top of the page, you’ll see a horizontal navbar. Click the
Behavior
entry. You’ll likely only have one entry. Click the radio button, and go toEdit
. The setting you’ll be looking for is theViewer protocol policy
which needs to be set toRedirect HTTP to HTTPS
(see below).It may take a few minutes after saving the changes for the update to be made to the CloudFront network.
Based on the discussion over chat, it seems the
CNAME
for your sub-domainfile.example.com
is pointing to the S3 bucket URL instead of CloudFront.Because I can not see CloudFront anywhere in the response headers. Can you please update that and then try?