Static Site part 2 - CloudFront, SSL and www.

Continuing the statc site setup (or rather enhancement at this point) I wanted to:

  • Setup CloudFront, allowing content to be cached and fetched from the AWS's content delivery network (CDN) instead...you know so the hundreds of thousands of users hitting this site (2 hits so far but thinking ahead when I'll be monetizing it, quitting my daily job) get to the content faster. 
  • Redirect http to https since we are security conscious.
  • Since apparently www is still a thing, setup an alias so that anyone visiting www.butfirstcoffee.me doesn't get a 404. 

To make all of the above happen, the following writeups came in handy:

Gotchas:
Forgetting the apex domain in the cert request. 

When requesting a cert, I forgot to include the apex domain in the request. I just issued a request for *.butfirstcoffee.me. This will prevent you from adding the apex domain to the CloudFront distribution under the Alternate Domain Names section since the cert won't cover it.

Don't be me - in the AWS Certificate Manager, just hit the button "Add another name to this certificate" and include your apex domain there. 

No CSS loaded after https

Initially when I setup Publii I didn't have https in place. Once https was in the picture the site would load but without any of the CSS. Initially I thought that CloudFront is still updating the edge locaitons so I left it overnight to do so. When I checked the next morning the situation was still the same - plain site - no CSS. After consuming some coffee I had an epiphany, tweaked the following in Publii and reuploaded the content: