Charlene
Charlene

Reputation: 337

AWS S3 Website with Route 53 Domain, needs https through CloudFront

So I created two buckets in S3. One with my domain name xxx.ninja and the other with the www. subdomain. The www one I redirected to the first. Then I created a domain in Route 53. And because I wanted https on my site I created a cloudfront distribution with redirect http -> https.

The s3 bucket url works just fine, but the site URL does not. I think I may have set it up incorrectly.

In AWS CloudFront I created my distribution and used the cloudfront default SSL cert. I choose redirect http -> https. And I pasted in my s3 website URL.

Then I copied the domain name and went to Route 53. After I created my domain I open its hosted zone and added an A record with the alias of the cloudfront domain name.

But the URL doesn't work. I get a 403 CloudFront error in the browser.

Thoughts?

Upvotes: 1

Views: 191

Answers (1)

Chris Williams
Chris Williams

Reputation: 35188

IF you're using the default CloudFront SSL this indicates to me that you're not using a custom hostname (which would deny access to the CloudFront distribution).

You will need to add additional names to your CloudFront distribution (specifying every hostname that will have a DNS record resolving to the CloudFront distribution). In addition you will need to generate an SSL in ACM (which is free), this must be in region us-east-1.

More information on how to add a custom domain to your CloudFront distribution is available here.

Upvotes: 1

Related Questions