@@ -28,7 +28,7 @@ resource "aws_cloudfront_cache_policy" "this" {
2828 enable_accept_encoding_gzip = true
2929 enable_accept_encoding_brotli = true
3030 cookies_config {
31- cookie_behavior = " none "
31+ cookie_behavior = " all "
3232 }
3333 headers_config {
3434 header_behavior = " none"
@@ -39,6 +39,18 @@ resource "aws_cloudfront_cache_policy" "this" {
3939
4040 }
4141}
42+ resource "aws_cloudfront_origin_request_policy" "this" {
43+ name = module. this_label . id
44+ cookies_config {
45+ cookie_behavior = " all"
46+ }
47+ headers_config {
48+ header_behavior = " none"
49+ }
50+ query_strings_config {
51+ query_string_behavior = " all"
52+ }
53+ }
4254# tfsec:ignore:AWS045
4355resource "aws_cloudfront_distribution" "this" {
4456 origin {
@@ -65,13 +77,16 @@ resource "aws_cloudfront_distribution" "this" {
6577 default_root_object = var. default_root_object
6678 aliases = var. cloudfront_aliases
6779 default_cache_behavior {
68- allowed_methods = var. allowed_methods
69- cached_methods = var. cached_methods
70- target_origin_id = var. s3_origin_id
71- compress = true
72- cache_policy_id = aws_cloudfront_cache_policy. this . id
73- viewer_protocol_policy = var. viewer_protocol_policy
74- min_ttl = var. cf_min_ttl
80+ allowed_methods = var. allowed_methods
81+ cached_methods = var. cached_methods
82+ target_origin_id = var. s3_origin_id
83+ compress = true
84+ cache_policy_id = aws_cloudfront_cache_policy. this . id
85+ origin_request_policy_id = aws_cloudfront_origin_request_policy. this . id
86+ viewer_protocol_policy = var. viewer_protocol_policy
87+ min_ttl = var. cf_min_ttl
88+ max_ttl = var. cf_max_ttl
89+ default_ttl = var. cf_default_ttl
7590 }
7691 price_class = var. cf_price_class
7792 viewer_certificate {
0 commit comments