Skip to content

Commit 55aa1da

Browse files
authored
Potentially compress all API responses (#149)
1 parent abdfb46 commit 55aa1da

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

cloudformation/main.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ Resources:
783783
CachedMethods:
784784
- GET
785785
- HEAD
786-
CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad # caching disabled
786+
CachePolicyId: !Ref CloudfrontNoCachePolicy # caching disabled
787787
OriginRequestPolicyId: 216adef6-5c7f-47e4-b989-5492eafa07d3
788788
Compress: true
789789
ViewerCertificate:
@@ -808,6 +808,25 @@ Resources:
808808
Action: s3:GetObject
809809
Resource: !Sub "${AppFrontendS3Bucket.Arn}/*"
810810

811+
CloudfrontNoCachePolicy:
812+
Type: AWS::CloudFront::CachePolicy
813+
Properties:
814+
CachePolicyConfig:
815+
Comment: Cache policy with caching disabled and Gzip/Brotli enabled
816+
DefaultTTL: 0
817+
MaxTTL: 1
818+
MinTTL: 0
819+
Name: NoCache-GzipBrotli-Enabled
820+
ParametersInCacheKeyAndForwardedToOrigin:
821+
CookiesConfig:
822+
CookieBehavior: none
823+
EnableAcceptEncodingBrotli: true
824+
EnableAcceptEncodingGzip: true
825+
HeadersConfig:
826+
HeaderBehavior: none
827+
QueryStringsConfig:
828+
QueryStringBehavior: none
829+
811830
CloudfrontCachePolicy:
812831
Type: AWS::CloudFront::CachePolicy
813832
Properties:

0 commit comments

Comments
 (0)