CloudFront Setup
Setting up CloudFront with S3 for static sites - lessons learned.
The Challenge
Deploying a Hugo site to S3 + CloudFront isn’t as straightforward as it should be. Here’s what actually works.
Required Components
|
|
The Missing Pieces
Default Root Object
Set to index.html - only works for root URL though.
CloudFront Function
Required for directory handling:
|
|
Bucket Policy
|
|
Cache Settings
- Default TTL: 24 hours
- Max TTL: 1 year
- Compression: Gzip + Brotli enabled
Deployment
Hugo’s built-in S3 deployment works great:
|
|
Much simpler than custom scripts.
Tags: