Better HN
topnewbestaskshowjobs
Log inSign up

BayesianDice

103 karma · joined May 19, 2015 (11y ago) · 34 submissions

Submissions

comment 6y ago · link · parent

Thanks for that - I certainly agree that's simpler than Lambda@Edge, and option well worth considering.

I looked at that approach at the time but didn't go down that route because, as far as I understood (unless I missed something), that would involve having the S3 bucket directly publicly accessible over HTTP (not HTTPS) with the S3-style URLs, including public access. And my main motivation for adding CloudFront to the mix was to support/enforce TLS - I certainly didn't have traffic levels requiring it!

(But, pragmatically, the key risks of someone going to the effort of finding and using the unpublished S3 URL would seem to be be that (a) the site could stop working if I change the hosting and (b) they, through their own choice, aren't using TLS - which, for a static, low-traffic, personal blog, could be considered pretty low.)

comment 6y ago · link · parent

Thanks, that makes sense - I've not used ReactJS, but guessed that your site only needed the top-level index.html, so that was handy.

comment 6y ago · link · parent

I did find one catch with the S3/CloudFront approach, relating to default document, when I was looking at hosting a static Hugo site a few months ago. With S3 web hosting, you can specify a default object which also works for subdirectories (e.g. so http://www.example.com returns http://www.example.com/index.html and http://www.example.com/foo returns http://www.example.com/foo/index.html). With Cloudfront, the default document doesn't apply to subdirectories, which would have broken my site.

(For the author of this article, it looks like the combination of CLoudFront's default document and custom error handling did the job for their site - just flagging this as something to look out for in cases where it doesn't work :-) )

AWS suggest a workaround using Lambda@Edge (https://aws.amazon.com/blogs/compute/implementing-default-di...) to rewrite the requests at the CloudFront layer - but at that point I decided that actually getting the site published was more important than adding more to the technology stack, so it's now happily hosted on Netlify's free tier.

comment 6y ago · link · parent

^W denotes Ctrl-W, the shortcut to delete the previous word for example originally in Berkley (thanks Wikipedia!) Unix-style terminals (and ^H denotes the control code for backspace, deleting the previous letter). The Jargon File's example shows how these are used for humorous effect: '"Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ." reads roughly as “Be nice to this fool, er, gentleman...”, with irony emphasized.' (http://www.catb.org/~esr/jargon/html/writing-style.html)
12