From 6649c09d12cc2c0880a2dd328b6b7bd4f8802eee Mon Sep 17 00:00:00 2001 From: Joe Lothan Date: Mon, 25 May 2026 23:33:49 -0400 Subject: [PATCH] longer cache for the tabs/ s3 bucket --- infra/main.tf | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/infra/main.tf b/infra/main.tf index ed2e592..5540b9c 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -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