Skip to content

Commit

Permalink
infra: update cloudfront origin request policy (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Nov 30, 2024
1 parent 0ae5b65 commit 2f202bc
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions terraform/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ resource "aws_cloudfront_distribution" "main" {

# cache_policy_id = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad" #Managed-CachingDisabled
cache_policy_id = aws_cloudfront_cache_policy.default.id
origin_request_policy_id = aws_cloudfront_origin_request_policy.admin.id
origin_request_policy_id = aws_cloudfront_origin_request_policy.default.id

function_association {
event_type = "viewer-request"
Expand Down Expand Up @@ -185,7 +185,7 @@ resource "aws_cloudfront_cache_policy" "default" {
enable_accept_encoding_gzip = true

cookies_config {
cookie_behavior = "none"
cookie_behavior = "all"
}

headers_config {
Expand All @@ -201,28 +201,6 @@ resource "aws_cloudfront_cache_policy" "default" {
resource "aws_cloudfront_origin_request_policy" "default" {
name = "${local.namespace}-origin-request-policy"

cookies_config {
cookie_behavior = "none"
}

headers_config {
header_behavior = "allViewerAndWhitelistCloudFront"

headers {
items = [
"CloudFront-Forwarded-Proto",
]
}
}

query_strings_config {
query_string_behavior = "all"
}
}

resource "aws_cloudfront_origin_request_policy" "admin" {
name = "${local.namespace}-admin-origin-request-policy"

cookies_config {
cookie_behavior = "all"
}
Expand Down

0 comments on commit 2f202bc

Please sign in to comment.