Skip to content

Commit

Permalink
fix: cloudfront cache policy
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 13, 2023
1 parent d8f6a34 commit 5d82063
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions terraform/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,37 +56,11 @@ resource "aws_cloudfront_distribution" "main" {
}
}

# Logged in container
dynamic "ordered_cache_behavior" {
for_each = [
"dashboard",
"filament-excel",
"admin",
]

content {
path_pattern = "/${ordered_cache_behavior.value}/*"
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = aws_lb.main.dns_name
cache_policy_id = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad" #Managed-CachingDisabled
origin_request_policy_id = aws_cloudfront_origin_request_policy.default.id
viewer_protocol_policy = "redirect-to-https"
compress = true

function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.www_redirect.arn
}
}
}

# Public Container
default_cache_behavior {
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = aws_lb.main.dns_name
cache_policy_id = aws_cloudfront_cache_policy.default.id
cache_policy_id = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad" #Managed-CachingDisabled
origin_request_policy_id = aws_cloudfront_origin_request_policy.default.id
viewer_protocol_policy = "redirect-to-https"
compress = true
Expand Down

0 comments on commit 5d82063

Please sign in to comment.