Unable to set ResponseHeadersPolicyId via CloudFormation

0

I found this post: https://forums.aws.amazon.com/thread.jspa?threadID=347842, now i found myself in the same spot but cannot make it work. I get this message:

UPDATE_FAILED: CloudFrontDistribution (AWS::CloudFront::Distribution) Property validation failure: [Encountered unsupported properties in {/DistributionConfig/DefaultCacheBehavior}: [ResponseHeadersPolicyId]]

I'm in the eu-south-1 regiono, if that can help. Thanks

edit: i add part of my configuration as example:

    CloudFrontDistribution:
      Type: AWS::CloudFront::Distribution
      DependsOn: [ CloudFrontCustomNoCachePolicy ]
      Properties:
        DistributionConfig:
          HttpVersion: http2
          Enabled: true
          DefaultCacheBehavior:
            ViewerProtocolPolicy: redirect-to-https
            AllowedMethods:
              - GET
              - HEAD
              - OPTIONS
              - PUT
              - PATCH
              - POST
              - DELETE
            CachedMethods:
              - GET
              - HEAD
              - OPTIONS
            CachePolicyId: { Ref: CloudFrontCustomNoCachePolicy }
            Compress: true
            OriginRequestPolicyId: 59781a5b-3903-41f3-afcb-af62929ccde1 # ID of managed Managed-CORS-CustomOrigin
            # dosnt work... why? it is needed tho
            ResponseHeadersPolicyId: 5cc3b908-e619-4b99-88e5-2cf7f45965bd # ID of managed Managed-CORS-With-Preflight
            TargetOriginId: XXX

if i comment out ResponseHeadersPolicyId it works

Nemolo
asked 2 years ago1339 views
1 Answer
0

Maybe you did some typo or is putting this property in the wrong place?

Here you can find my code with this field which works :)

profile picture
MG
answered 2 years ago
  • Thanks for the answer, i updated the question with part of my configuration

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions