Skip to content

Commit 8bbc615

Browse files
committed
Use CloudFront managed caching policies
1 parent 36dfdcf commit 8bbc615

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

resources/saas-boost-web.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ Resources:
3737
Type: AWS::CloudFront::Distribution
3838
Properties:
3939
DistributionConfig:
40+
Comment: Saas Boost Admin Console
41+
DefaultRootObject: index.html
42+
Enabled: true
43+
IPV6Enabled: false
44+
HttpVersion: http2
4045
Origins:
4146
- DomainName: !Sub ${WebS3Bucket}.s3.${AWS::Region}.amazonaws.com
4247
Id: !Sub sb-${Environment}-s3-website
4348
S3OriginConfig:
4449
OriginAccessIdentity: !Sub origin-access-identity/cloudfront/${ConsoleOriginAccessIdentity}
45-
Enabled: true
46-
Comment: Saas Boost Admin Console
47-
DefaultRootObject: index.html
4850
CustomErrorResponses:
4951
- ErrorCode: 403
5052
ResponseCode: 200
@@ -59,13 +61,19 @@ Resources:
5961
- PATCH
6062
- POST
6163
- PUT
64+
CachedMethods:
65+
- GET
66+
- HEAD
67+
- OPTIONS
6268
TargetOriginId: !Sub sb-${Environment}-s3-website
63-
ForwardedValues:
64-
QueryString: false
65-
Cookies:
66-
Forward: none
67-
ViewerProtocolPolicy: allow-all
68-
IPV6Enabled: true
69+
ViewerProtocolPolicy: redirect-to-https
70+
Compress: true
71+
# CachingOptimized managed cache policy
72+
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
73+
# CORS-S3Origin managed origin request policy
74+
OriginRequestPolicyId: 88a5eaf4-2fd4-4709-b370-b4c650ea3fcf
75+
# CORS-with-preflight-and-SecurityHeadersPolicy managed response headers policy
76+
ResponseHeadersPolicyId: eaab4381-ed33-4a86-88ca-d9558dc6cd63
6977
ViewerCertificate:
7078
CloudFrontDefaultCertificate: true
7179
ConsoleUserPool:

0 commit comments

Comments
 (0)