I'm configuring my CloudFront using CloudFormation, and on the AWS documentation page for the ForwardedValues
property, we can see the following statement:
If you specify true for
QueryString
and you don't specify any values forQueryStringCacheKeys
, CloudFront forwards all query string parameters to the origin and caches based on all query string parameters.
The word in bold (caches) are causing some confusion, as the meaning of this sentence is completely dependent on caches being a verb or caches being a noun:
If I don't specify the QueryStringCacheKeys
, what is the behaviour of CloudFront?
I fixed it by specifying CachePolicyId
as in 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
If you don't specify the QueryStringCacheKeys
, but only this:
ForwardedValues:
QueryString: true
CloudFront will Forward all, cache based on all
, which means that the request will be cached based on url+querystring
and that the querystring is forwarded to the underlying system.
You can read more on this in the AWS documentation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With