5 ms·
Thinking of moving a static site to S3 + CloudFront + AWS Certificate Manager with the purpose of enabling HTTPS for the site. Seems like CloudFront does not su
by jaxondu 10y ago
Thinking of moving a static site to S3 + CloudFront + AWS Certificate Manager with the purpose of enabling HTTPS for the site. Seems like CloudFront does not support index document even if you've enabled it on S3 (https://tiffanybbrown.com/2016/01/aws-certificate-manager-s3-cloudfront-urls/index.html https://tiffanybbrown.com/2016/01/aws-certificate-manager-s3...). You can't have URL such as https://example.com/about/ https://example.com/about/. Instead need to specifically use URL https://example.com/about/index.html https://example.com/about/index.html.
Will look into Netlify and Aerobatic next. Are there other PaaS/SaaS that makes it easy to host HTTPS static site generated from Jekyll/Hugo?
- adyus 10y agoI'm using index document paths on S3 + CloudFront right now, it's definitely possible. Unfortunately, I don't remember exactly what I did to make it work. Some more Googling might give you the answer. Edit: the setting is called "Default Root Object" when setting up a CloudFront distribution with an S3 origin.
- jjnoakes 10y agoDoes that setting apply to any subdirectory? The article linked in a comment above states otherwise.
- brandur 10y ago> Does that setting apply to any subdirectory? The article linked in a comment above states otherwise. No, unfortunately it doesn't. One workaround that I use is to upload files without an extension and explicitly set their content type as `text/html` in S3. So a request to `/about` just serves a file in your S3 bucket called `about`. This works with both CloudFront and S3. I wrote about a few more details of the process here: https://brandur.org/fragments/aws-static-hosting-workaround https://brandur.org/fragments/aws-static-hosting-workaround
- jaxondu 10y agoAre you doing HTTPS? According to the article, the problem exists when running over HTTPS.
- yanokwa 10y agoI use and like https://github.com/laurilehmijoki/s3_website https://github.com/laurilehmijoki/s3_website.
- kasbah 10y agoI use Kloudsec CDN to get HTTPS on my static sites. It's very easy to set up and free (certificates are from Let's Encrypt). You can use it for custom domains on GitHub pages as well. https://www.kloudsec.com/ https://www.kloudsec.com/
- deleted 10y ago[deleted]
- owenconti 10y agoThat is not true. This site is built with Hugo hosted on S3, running behind CloudFront and uses the AWS Certificate Manager: https://owenconti.com/about/ https://owenconti.com/about/
- owenconti 10y agoReplying to myself as a follow up: Make sure the S3 bucket is set to Static Website Hosting mode, and make sure your Index and Error documents are set appropriately. Then make sure your CloudFront distribution is pointed at the Website's endpoint and NOT the normal S3 endpoint.
- dwightgunning 10y agoThat's exactly my configuration and works like a charm.
- owenconti 10y agoI initially had issues because I was pointing CloudFront at the normal S3 endpoint. Once that was solved, everything started working smoothly.