Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions modules/agm-talk/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,23 @@ resource "aws_cloudfront_distribution" "app" {
# 2. Uncomment the AFTER block below
# 3. terraform apply
# ===========================================================================
default_cache_behavior {
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "lambda-app"
viewer_protocol_policy = "allow-all"

forwarded_values {
query_string = false
cookies {
forward = "none"
}
}

min_ttl = 1
default_ttl = 1
max_ttl = 1
}
# default_cache_behavior {
# allowed_methods = ["GET", "HEAD", "OPTIONS"]
# cached_methods = ["GET", "HEAD"]
# target_origin_id = "lambda-app"
# viewer_protocol_policy = "allow-all"

# forwarded_values {
# query_string = false
# cookies {
# forward = "none"
# }
# }

# min_ttl = 1
# default_ttl = 1
# max_ttl = 1
# }

# ===========================================================================
# AFTER: The dangerous config (cache policy + origin request policy)
Expand All @@ -167,14 +167,14 @@ resource "aws_cloudfront_distribution" "app" {
#
# To activate: uncomment this block and comment out the BEFORE block above.
# ===========================================================================
# default_cache_behavior {
# allowed_methods = ["GET", "HEAD", "OPTIONS"]
# cached_methods = ["GET", "HEAD"]
# target_origin_id = "lambda-app"
# viewer_protocol_policy = "allow-all"
# cache_policy_id = aws_cloudfront_cache_policy.static_assets.id
# origin_request_policy_id = aws_cloudfront_origin_request_policy.forward_all.id
# }
default_cache_behavior {
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "lambda-app"
viewer_protocol_policy = "allow-all"
cache_policy_id = aws_cloudfront_cache_policy.static_assets.id
origin_request_policy_id = aws_cloudfront_origin_request_policy.forward_all.id
}

restrictions {
geo_restriction {
Expand Down