@@ -200,6 +200,9 @@ Resources:
200200 CloudFrontCachePolicy :
201201 Type : AWS::CloudFront::CachePolicy
202202 Properties :
203+ # The headers, cookies, and query strings that are included in the
204+ # CACHE KEY (CachePolicyConfig) are also included in requests that
205+ # CloudFront sends to the origin.
203206 CachePolicyConfig :
204207 Comment : !Sub Policy for ${AWS::StackName}
205208 DefaultTTL : 86400
@@ -212,12 +215,19 @@ Resources:
212215 EnableAcceptEncodingBrotli : false
213216 EnableAcceptEncodingGzip : false
214217 HeadersConfig :
215- HeaderBehavior : none
218+ HeaderBehavior : whitelist
219+ Headers :
220+ - Origin
221+ - Access-Control-Request-Headers
222+ - Access-Control-Request-Method
216223 QueryStringsConfig :
217224 QueryStringBehavior : none
218225 CloudFrontOriginRequestPolicy :
219226 Type : AWS::CloudFront::OriginRequestPolicy
220227 Properties :
228+ # The headers, cookies, and query strings that are included in the
229+ # CACHE KEY (CachePolicyConfig) are also included in requests that
230+ # CloudFront sends to the origin.
221231 OriginRequestPolicyConfig :
222232 Comment : !Sub Policy for ${AWS::StackName}
223233 CookiesConfig :
@@ -331,8 +341,8 @@ Resources:
331341 CacheBehaviors :
332342 - Fn::If :
333343 - HasRegion1
334- - AllowedMethods : [HEAD, GET]
335- CachedMethods : [HEAD, GET]
344+ - AllowedMethods : [HEAD, GET, OPTIONS ]
345+ CachedMethods : [HEAD, GET, OPTIONS ]
336346 CachePolicyId : !Ref CloudFrontCachePolicy
337347 Compress : false
338348 FunctionAssociations :
@@ -349,8 +359,8 @@ Resources:
349359 - !Ref AWS::NoValue
350360 - Fn::If :
351361 - HasRegion2
352- - AllowedMethods : [HEAD, GET]
353- CachedMethods : [HEAD, GET]
362+ - AllowedMethods : [HEAD, GET, OPTIONS ]
363+ CachedMethods : [HEAD, GET, OPTIONS ]
354364 CachePolicyId : !Ref CloudFrontCachePolicy
355365 Compress : false
356366 FunctionAssociations :
@@ -367,8 +377,8 @@ Resources:
367377 - !Ref AWS::NoValue
368378 - Fn::If :
369379 - HasRegion3
370- - AllowedMethods : [HEAD, GET]
371- CachedMethods : [HEAD, GET]
380+ - AllowedMethods : [HEAD, GET, OPTIONS ]
381+ CachedMethods : [HEAD, GET, OPTIONS ]
372382 CachePolicyId : !Ref CloudFrontCachePolicy
373383 Compress : false
374384 FunctionAssociations :
0 commit comments