Part one of updating this blog was to move from a Ruby based static generator to a Node.js based static generator.

The next changes were to raise the Lighthouse score.

As this blog is a static site with close to zero JavaScript the main work involved switching from http to https. Github pages do not support https when using custom domains. You can involve Cloudflare but I was looking for a different host for some future projects anyway.

Had a play with now by ZEIT which looks great but for $15 a month to use custom domains it seemed a product not intended for just static hosting when the real power is hosting actual applications.

Had a look at surge.sh but decided to go with AWS and an S3 + CloudFront + Certificate Manager for the following reasons:

  1. Previous experience with S3 and the AWS Cli
  2. Certificate Manager automatically handles the SSL certificate renewal
  3. Bonus: I can consolidate domains on Route 53 DNS. I have a .co.uk email address I still periodically use and Route 53 supporting .co.uk is a boon. .co.uk domains have some weird quirks which is why not a lot of DNS services support it.

Getting the AWS stack set up was pretty easy apart from when after adding CloudFront, root url aside, blog posts could only be loaded by directly accessing S3 objects: /blog-post/index.html and not /blog-post/. The solution is here http://brajeshwar.com/2013/why-wont-index-files-deployed-on-cloudfront-work-like-it-does-in-s3/. CloudFront cache invalidation via the cli is useful https://chankongching.wordpress.com/2015/07/16/how-to-use-aws-cli-for-cloudfront-invalidation/.

With SSL and HTTP/2 in place, the final piece of work was adding a service worker for offline support. Went with the cache then network solution

The result is a 100/100 score in Lighthouse. Lighthouse score