From 5855e2583243330186ab0f8d3fb6fdf2e39b2948 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 27 May 2025 17:26:35 -0500 Subject: [PATCH 1/3] Potentially compress all API responses --- cloudformation/main.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cloudformation/main.yml b/cloudformation/main.yml index 2e66360b..cd3bf688 100644 --- a/cloudformation/main.yml +++ b/cloudformation/main.yml @@ -783,7 +783,7 @@ Resources: CachedMethods: - GET - HEAD - CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad # caching disabled + CachePolicyId: !Ref CloudfrontNoCachePolicy # caching disabled OriginRequestPolicyId: 216adef6-5c7f-47e4-b989-5492eafa07d3 Compress: true ViewerCertificate: @@ -808,6 +808,25 @@ Resources: Action: s3:GetObject Resource: !Sub "${AppFrontendS3Bucket.Arn}/*" +CloudfrontNoCachePolicy: + Type: AWS::CloudFront::CachePolicy + Properties: + CachePolicyConfig: + Comment: Cache policy with caching disabled and Gzip/Brotli enabled + DefaultTTL: 0 + MaxTTL: 0 + MinTTL: 0 + Name: NoCache-GzipBrotli-Enabled + ParametersInCacheKeyAndForwardedToOrigin: + CookiesConfig: + CookieBehavior: none + EnableAcceptEncodingBrotli: true + EnableAcceptEncodingGzip: true + HeadersConfig: + HeaderBehavior: none + QueryStringsConfig: + QueryStringBehavior: none + CloudfrontCachePolicy: Type: AWS::CloudFront::CachePolicy Properties: From 7ee7c333f49d5d20e8aa68e868cbc3c92d4ac3c2 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 27 May 2025 17:28:54 -0500 Subject: [PATCH 2/3] fix indent --- cloudformation/main.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/cloudformation/main.yml b/cloudformation/main.yml index cd3bf688..5e06ab4a 100644 --- a/cloudformation/main.yml +++ b/cloudformation/main.yml @@ -808,24 +808,24 @@ Resources: Action: s3:GetObject Resource: !Sub "${AppFrontendS3Bucket.Arn}/*" -CloudfrontNoCachePolicy: - Type: AWS::CloudFront::CachePolicy - Properties: - CachePolicyConfig: - Comment: Cache policy with caching disabled and Gzip/Brotli enabled - DefaultTTL: 0 - MaxTTL: 0 - MinTTL: 0 - Name: NoCache-GzipBrotli-Enabled - ParametersInCacheKeyAndForwardedToOrigin: - CookiesConfig: - CookieBehavior: none - EnableAcceptEncodingBrotli: true - EnableAcceptEncodingGzip: true - HeadersConfig: - HeaderBehavior: none - QueryStringsConfig: - QueryStringBehavior: none + CloudfrontNoCachePolicy: + Type: AWS::CloudFront::CachePolicy + Properties: + CachePolicyConfig: + Comment: Cache policy with caching disabled and Gzip/Brotli enabled + DefaultTTL: 0 + MaxTTL: 0 + MinTTL: 0 + Name: NoCache-GzipBrotli-Enabled + ParametersInCacheKeyAndForwardedToOrigin: + CookiesConfig: + CookieBehavior: none + EnableAcceptEncodingBrotli: true + EnableAcceptEncodingGzip: true + HeadersConfig: + HeaderBehavior: none + QueryStringsConfig: + QueryStringBehavior: none CloudfrontCachePolicy: Type: AWS::CloudFront::CachePolicy From 4a16eb8e9907a1914c81255aa3aa2bb1793cc860 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 27 May 2025 17:36:53 -0500 Subject: [PATCH 3/3] set maxttl to 1 --- cloudformation/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudformation/main.yml b/cloudformation/main.yml index 5e06ab4a..99922545 100644 --- a/cloudformation/main.yml +++ b/cloudformation/main.yml @@ -814,7 +814,7 @@ Resources: CachePolicyConfig: Comment: Cache policy with caching disabled and Gzip/Brotli enabled DefaultTTL: 0 - MaxTTL: 0 + MaxTTL: 1 MinTTL: 0 Name: NoCache-GzipBrotli-Enabled ParametersInCacheKeyAndForwardedToOrigin: