gpt4 book ai didi

caching - aws cloudformation CachePolicy 一般错误

转载 作者:行者123 更新时间:2023-12-04 08:10:26 25 4
gpt4 key购买 nike

我正在尝试创建一个转发所有内容(cookie、查询字符串和 header )的缓存策略,并且实际上不缓存任何内容:

    Type: AWS::CloudFront::CachePolicy
Properties:
CachePolicyConfig:
Comment: Cache Policy
DefaultTTL: 0
MaxTTL: 0
MinTTL: 0
Name: !Sub ${AWS::StackName}-cache-policy
ParametersInCacheKeyAndForwardedToOrigin:
CookiesConfig:
CookieBehavior: all
EnableAcceptEncodingBrotli: true
EnableAcceptEncodingGzip: true
HeadersConfig:
HeaderBehavior: whitelist
Headers:
- "*"
QueryStringsConfig:
QueryStringBehavior: all

和我的 OriginRequestPolicy:

OriginRequestPolicy:
Type: AWS::CloudFront::OriginRequestPolicy
Properties:
OriginRequestPolicyConfig:
Name: !Sub ${AWS::StackName}-origin-request
CookiesConfig:
CookieBehavior: all
HeadersConfig:
HeaderBehavior: allViewer
QueryStringsConfig:
QueryStringBehavior: all

但是当我尝试上传堆栈时,我收到一个一般错误:

The following resource(s) failed to create: [OriginRequestPolicy, CachePolicy]. Rollback requested by user. OriginRequestPolicy CREATE_FAILED   Resource creation cancelled CachePolicy CREATE_FAILED   Invalid request provided: AWS::CloudFront::CachePolicy

我错过了什么?

obs:我不能只创建一个AWS::CloudFront::OriginRequestPolicy,因为似乎我只能在先存在cacheRequestPolicy的情况下才能拥有OriginRequestPolicy。

最佳答案

我不知道为什么“手动方式”不起作用,但我从文档中找到了2个满足我需求的预制策略:

Name: Managed-CachingDisabled
ID: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad
This policy disables caching. This policy is useful for dynamic content and for requests that are not cacheable.

Name: Managed-AllViewer
ID: 216adef6-5c7f-47e4-b989-5492eafa07d3
This policy includes all values (query strings, headers, and cookies) in the viewer request.

文档引用:

https://docs.amazonaws.cn/en_us/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html

https://docs.amazonaws.cn/en_us/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html

关于caching - aws cloudformation CachePolicy 一般错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65995456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com