0
votes

Is there any way to set the "Allowed HTTP Methods" to "GET, HEAD, PUT, POST, PATCH, DELETE, OPTIONS" using CloudFormation? I have a cache behavior described in my stack but by default it only accepts GET and HEAD but and I need it to accept POST method. How do I do that using CloudFormation?

2

2 Answers

0
votes

As this property is not available in the CacheBehavior type, i believe it is not available to be set through CloudFormation. You might set it using the API and a CustomResource, but that might be complex. See these examples for how that approach would go.

0
votes

Yes it is possible to do it like this:

CacheBehavior:
  TargetOriginId: ***-***-***
  ViewerProtocolPolicy: redirect-to-https
  MinTTL: 0
  AllowedMethods: [DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT]
  CachedMethods: [HEAD, GET]
  Compress: true
  ForwardedValues:
    Headers: ['*']
    QueryString: true
    Cookies:
      Forward: all