How to configure naked domain to be hosted on a CDN


  • having a website without www keeps the name simple by removing junk (long live Edward Tufte)
  • hosting a static site on a CDN is cost effective and performant
  • https is very important

But looks like it’s not that simple to have all three checks. Here is my path to have them:

0. Have a static website

There are a lot of generators, I tried docpad, gohugo and really like the gatsby.

Optional: FastMail

I use FastMail for my personal and corporate email, and it works fantastic. Even if you add multiple domains, you can configure the MX DNS entries to FastMail, add Personas and you can have infinite email addresses, but pay for a single user. It’s really good.

1. Use DNSimple

I think it makes sense to host the DNS separate from your domain register, and DNSimple is one of the few that provides DNS hosting with Alias, so use them — with this link you and me will both get $5.

2. Buy a domain name

I use dreamhost (their latest UI tricks the user too much, so I won’t recommend them. One advantage is that privacy is included in the price). I guess any domain registrar will work. After buying the domain, set the namespaces to,, etc.

DNSimple namespaces

3. Create a bucket on S3 and upload the website there

Bucket name should be your new domain name, for example I usually set public permissions to read

S3 Permissions

To upload the website, I use gulp-awspublish

Make sure your website can be open on the s3 public URL.

4. Request a certificate

AWS has free https certificates, when you use their CDN (CloudFront). Request a certificate

Request Certificate

If everything was filled up properly when you bought your domain and configured mail for it, you would get a batch of emails from Amazon, click on the provided link, and you are set.

5. Add CloudFront facade for your s3 bucket.

I followed this article but with a slight change. For the Alternate Domain Names, set your domain name

Also check the redirect to HTTPS.

Test the website on the URL for CloudFront.

6. Configure ALIAS on DNSimple

Add a new entry for the domain, ALIAS, and point it to the CloudFront’s URL, like so


Pay attention that DNS entries must propagate, it can take a few minutes to hours to finish. But at the end, opening should redirect to

Mar 8th 2017