Skip to content

Commit db992c1

Browse files
jshaMark-Simulacrum
authored andcommitted
Set a long cache-control for fonts
1 parent 2d3e3e4 commit db992c1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

terraform/releases/impl/cache.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "aws_cloudfront_response_headers_policy" "cache-immutable" {
2+
name = "cache-immutable"
3+
4+
custom_headers_config {
5+
items {
6+
header = "Cache-Control"
7+
override = true
8+
value = "immutable, max-age=9999999"
9+
}
10+
}
11+
}

terraform/releases/impl/cloudfront-doc.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ resource "aws_cloudfront_distribution" "doc" {
4949
}
5050
}
5151

52+
ordered_cache_behavior {
53+
path_pattern = "*.woff2"
54+
cache_policy_id = "cache-immutable"
55+
allowed_methods = ["GET", "HEAD", "OPTIONS"]
56+
cached_methods = ["GET", "HEAD", "OPTIONS"]
57+
target_origin_id = "main"
58+
59+
forwarded_values {
60+
headers = []
61+
query_string = false
62+
63+
cookies {
64+
forward = "none"
65+
}
66+
}
67+
68+
min_ttl = 0
69+
default_ttl = 86400
70+
max_ttl = 31536000
71+
compress = true
72+
viewer_protocol_policy = "redirect-to-https"
73+
}
74+
5275
origin {
5376
origin_id = "main"
5477
domain_name = aws_s3_bucket.static.website_endpoint

0 commit comments

Comments
 (0)