From 5d820639547dd19b5f0d15e4fa726c6b2528c7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Wed, 13 Dec 2023 17:05:09 +0000 Subject: [PATCH] fix: cloudfront cache policy --- terraform/cloudfront.tf | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/terraform/cloudfront.tf b/terraform/cloudfront.tf index 4446330d..5461eec4 100644 --- a/terraform/cloudfront.tf +++ b/terraform/cloudfront.tf @@ -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