The website is served through the following components:
- S3 Bucket: Stores the static website files
- CloudFront Distribution: CDN that serves the content globally
- Lambda@Edge Function: Handles URL mapping for blog posts
When a user requests a page:
- For the homepage (
/): S3 servesindex.htmldirectly - For blog posts (
/posts/*): Lambda@Edge function modifies the request to append.htmlextension - For 404 errors: CloudFront returns
index.htmlwith 200 status code
- Configured for static website hosting
index.htmlset as the default document- Public read access enabled
- Origin: S3 bucket
- Default behavior: Direct S3 access
- Additional behavior for
/posts/*: Lambda@Edge is called for origin request (before it hits the bucket) to append.htmlextension so file can be found in the bucket. - Error responses: if the file is not found in s3, CloudFront returns
index.htmlwith 200 status code.
- Triggered on origin request for
/posts/*paths - Appends
.htmlextension to requests without file extensions - Enables clean URLs for blog posts without showing
.htmlextension