DEV Community

Cover image for Unreachable static website distributed via AWS CloudFront
Sergio Matone
Sergio Matone

Posted on

Unreachable static website distributed via AWS CloudFront

DISCLAMER: The following was a very specific situation I find myself in when my own website hosted in an AWS S3 bucket and distributed via AWS CloudFront, stopped working. Here is how I solved the issue smoothly.


I own a very simple personal website and I used to host it in an AWS bucket.

πŸ‘‰ This is it, Minimal Gap!

Distributing using my own domain just required to enable Static website hosting in AWS S3 Bucket properties and play a little bit with dns.

Here is a quick summary of how it was done.

  • S3 Bucket Name: minimalgap.com
  • DNS setup: cloud CNAME minimalgap.com.s3-website-eu-west-1.amazonaws.com

As a further step when I put it online, I decided to distribute it using a CDN, of course the easiest step was to leverage AWS CloudFront.

To do that I created an AWS distribution, I left most of the options as they are, just changed the following properties:

  • Origin Settings, for Origin Domain Name, enter the bucket website endpoint. You get this from the Static website hosting section of Properties for the Amazon S3 bucket. This will result in Origin Type being S3 static website.
  • I optionally generated a TLS certificate via AWS, to hold a certificate related to my own domain (minimalgap.com).

All of the above is well documented here

However, out of nowhere, my CloudFront Distribution stopped working. After a lot of digging I found out that some AWS configurations may have changed internally and my distribution was lacking of β€œsomething”, that prevent it to work correctly.

It was an issue with the Origin configuration itself. Indeed:

  • picking my own distribution in AWS Cloud Front and clicking on its ID,
  • getting to the view Origins, I found the correct configuration pointing to my S3 bucket,
  • trying to select and edit the problem was clear: the protocol selection was missing (HTTP, HTTPS, Match viewer).

Once I selected one of the values the distribution was back working as expected without any issue (see image below).
Therefore that something was actually the protocol selection within the Origin configuration!

Origin settings

As I said my idea is that AWS changed a little bit some configuration so distributions which were already setup, need to be manually fixed.
Maybe this will result useful for someone else encountering the same issue.

Top comments (0)