I am using route 53 for a domain (example.com) linked to my app on Heroku. To handle naked domain redirection, I am using a S3 bucket as explained here: https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/

As S3 doesn’t support SSL ( https:// example.com was not accessible), I set up a Cloudfront distribution (d2123.cloudfront.net) and a custom SSL (with SNI) linked to my S3 bucket as explained here:


I entered example.com in the field "CNAME alternate domain"

When I visit my cloud front distribution using https, I get redirected to my website at www.example.com, which tells me that my configuration is correct.

I am having a problem at the last step, when I set up route 53 to link example.com to my Cloudfront distribution. I created an ALIAS (from example.com to my Cloudfront) and https://example.com is redirected to https://www.example.com (Yay!) but http://example.com/* returns a Cloudfront Error

Anybody knows how to set route53 to have an ALIAS to a Cloudfront distribution linked to an S3 handling redirection?

  • So you can't use Elastic Load Balancer? Sorry, not understanding why you are using S3. Not familiar with Heroku. They don't have a solution? – Edwin Oct 21 '15 at 23:42
  • route 53 doesn't support naked domains apparently, so you need to use a S3 bucket for naked domains. devcenter.heroku.com/articles/route-53#naked-root-domain – Cyril Gaillard Oct 21 '15 at 23:51
  • 1
    The DNS Spec doesn't support naked domains. You can bring up a simple webserver to handle the redirects. I'm surprised heroku doesn't offer one. – Edwin Oct 21 '15 at 23:55
  • @Edwin Route 53 has an internal mechanism for this. CloudFront config calls alternate domains "cnames" but they are not really CNAMEs this configuration should work. – Michael - sqlbot Oct 21 '15 at 23:58
  • 1
    It's really quite elegant once you see it in action. It's a virtually no cost, low touch, serverless way of redirecting naked https://example.com to https://www.example.com. S3 introduced the redirect capability, and Route 53 alias integrates to S3 and CloudFront for exactly this purpose. – Michael - sqlbot Oct 22 '15 at 0:03

I found the problem in my configuration (Thanks to Michael's comment).

When I set the origin of the Cloudfront distribution, I entered example.com. It was supposed to be example.com.s3-website-us-east-1.amazonaws.com, the link in the S3 console. So to summarise, when one sets up a Cloudfront distribution for this issue, the origin is not the link in the dropdown menu, not the naked domain, it is the link in the S3 console in the Static Website Hosting >> Endpoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.