CloudFront ForwardedValues 不明确的文档

CloudFront ForwardedValues ambiguous documentation

我正在使用 CloudFormation 配置我的 CloudFront,在 the AWS documentation page for the ForwardedValues property 上,我们可以看到以下语句:

If you specify true for QueryString and you don't specify any values for QueryStringCacheKeys, CloudFront forwards all query string parameters to the origin and caches based on all query string parameters.

粗体字 (caches) 引起了一些混淆,因为这句话的意思完全取决于 caches 是一个动词或 caches 作为名词:

如果我不指定 QueryStringCacheKeys,CloudFront 的行为是什么?

如果您不指定 QueryStringCacheKeys,但仅指定:

ForwardedValues:
  QueryString: true

CloudFront 将 Forward all, cache based on all,这意味着请求将根据 url+querystring 进行缓存,并将查询字符串转发到底层系统。

您可以在 AWS 文档中阅读更多相关信息 here


我通过指定 CachePolicyId

修复了它

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html

    Type: "AWS::CloudFront::Distribution"
    Properties:
      DistributionConfig:
        DefaultCacheBehavior:
          # Name: Managed-CachingOptimized
          # need either this parameter or 'ForwardedValues'
          CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6