Re:Show HN: Scar – Static websites with HTTPS, a global CDN,...
by IanCal on Wednesday May 22, 2019 @11:54AM
(#19982509)
I think that behaviour should be handled with index documents in S3, without the need for lambda: https://docs.aws.amazon.com/AmazonS3/latest/dev/IndexDocumen...
Re:Show HN: Scar – Static websites with HTTPS, a global CDN,...
by FelipeCortez on Wednesday May 22, 2019 @02:55PM
(#19984286)
I've always used it this way and it works fine indeed.
Re:Show HN: Scar – Static websites with HTTPS, a global CDN,...
by cloudkj on Wednesday May 22, 2019 @02:19PM
(#19983917)
That should indeed be the default behavior out of the box with the way the S3 buckets are configured. I have a couple Jekyll sites deployed this way, and a request to the parent directory does get served by the contents in `index.html`. Are you not seeing that behavior?
I'd definitely like to add more variants of the default stack. At the minimum, I'm sure there are folks that prefer `www` redirects to the apex domain, or removing the `www` subdomain altogether.
I started with a setup similar to your diagram and tweaked it when I realized S3 didn't serve index.html when the URL was just the parent "directory", i.e. example.com/foo/ doesn't resolve to s3://example.com/foo/index.html. To get this working I had to write a bit of JS in a Lambda function and deploy it at the edge of my CloudFront distribution to do some URL rewriting.
Given that's the behavior most people expect, might be worth considering?