longer cache for the tabs/ s3 bucket

This commit is contained in:
Joe Lothan 2026-05-25 23:33:49 -04:00
parent 8e3907505f
commit 6649c09d12

View file

@ -283,6 +283,28 @@ resource "aws_cloudfront_distribution" "site" {
origin_access_control_id = aws_cloudfront_origin_access_control.site.id
}
# Bundles: 2-week cache (immutable between pipeline runs)
ordered_cache_behavior {
path_pattern = "tabs/*"
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "s3-site"
viewer_protocol_policy = "redirect-to-https"
compress = true
forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
min_ttl = 0
default_ttl = 1209600 # 2 weeks
max_ttl = 31536000 # 1 year
}
# Everything else (HTML, JS): 1-day cache
default_cache_behavior {
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
@ -297,7 +319,6 @@ resource "aws_cloudfront_distribution" "site" {
}
}
# Long cache for bundles, short for HTML/JS during development
min_ttl = 0
default_ttl = 86400 # 1 day
max_ttl = 31536000 # 1 year