feat(cloudfront): support for cache policies#10656
Conversation
Support for the new Cache Policy concept in CloudFront, which replaces the existing `ForwardedValues` properties and specifies what parts of a request make up the cache key, and what TTLs to use. _Implementation notes:_ * To achieve the API I wanted for the managed policies, I opted to *not* have `ICachePolicy` extend `IResource`. I admit to not understanding all of the implications of this, so welcome feedback. * I also opted to exclude the `cachePolicyLastUpdatedTimestamp` attribute from both `ICachePolicy` and `CachePolicy`, as the use case for them isn't clear, and handling the property for managed/imported cache policies was awkward. * Lastly, I opted to remove completely (rather than deprecate) the `forwardedValues` property, forcing users to create (or use managed) Cache Policies to achieve the same behavior. * Related to the above, `ForwardedValues` is marked as deprecated and optional in the CloudFormation docs, but if no `CachePolicyId` or `ForwardedValues` are specified, the deployment will fail claiming `ForwardedValues` is missing. That's why I opted to default the `CachePolicyId` to "CachingOptimized". *--NOTE: This functionality is currently broken:--* The CloudFormation support for creating new Cache Policies was released, but subsequent issues have been found and it appears users have been unable to create Cache Policies. See aws-cloudformation/cloudformation-coverage-roadmap#571 Marking this as draft until the above issue is resolved. fixes #9644 BREAKING CHANGES: Distribution `forwardedValues` have been removed in favor of `cachePolicy` and the new CachePolicy construct. * **cloudfront:** Distributions now default to the "CachingOptimized" managed cache policy
skinny85
left a comment
There was a problem hiding this comment.
Some small comments/suggestion.
Also, I think the "Breaking change" is wrong - the names of the properties that were removed are forwardQueryString and forwardQueryStringCacheKeys.
packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.expected.json
Outdated
Show resolved
Hide resolved
skinny85
left a comment
There was a problem hiding this comment.
Overall looks great! Couple of minor comments.
shivlaks
left a comment
There was a problem hiding this comment.
looks great! some minor suggestions for your consideration 🙂
Support for the new Origin Request Policy concept in CloudFront, which provides greater control to users over what values are forwarded to the origin from the original viewer request. _Implementation Notes:_ * *Heavily* influenced by #10656, including the same notes on not extending from `IResource` and excluding the `lastModifiedTimestamp`. * Currently marked as a DRAFT, since this PR *requires* #10656; origin request policies cannot be used without cache policies. fixes #9647
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Support for the new Origin Request Policy concept in CloudFront, which provides greater control to users over what values are forwarded to the origin from the original viewer request. _Implementation Notes:_ * *Heavily* influenced by #10656, including the same notes on not extending from `IResource` and excluding the `lastModifiedTimestamp`. fixes #9647
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Support for the new Origin Request Policy concept in CloudFront, which provides greater control to users over what values are forwarded to the origin from the original viewer request. _Implementation Notes:_ * *Heavily* influenced by #10656, including the same notes on not extending from `IResource` and excluding the `lastModifiedTimestamp`. fixes #9647
Support for the new Origin Request Policy concept in CloudFront, which provides greater control to users over what values are forwarded to the origin from the original viewer request. _Implementation Notes:_ * *Heavily* influenced by #10656, including the same notes on not extending from `IResource` and excluding the `lastModifiedTimestamp`. * Currently marked as a DRAFT, since this PR *requires* #10656; origin request policies cannot be used without cache policies. fixes #9647 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Support for the new Cache Policy concept in CloudFront, which replaces the
existing
ForwardedValuesproperties and specifies what parts of a requestmake up the cache key, and what TTLs to use.
Implementation notes:
ICachePolicyextendIResource. I admit to not understanding all of theimplications of this, so welcome feedback.
cachePolicyLastUpdatedTimestampattribute fromboth
ICachePolicyandCachePolicy, as the use case for them isn't clear,and handling the property for managed/imported cache policies was awkward.
forwardedValuesproperty, forcing users to create (or use managed) CachePolicies to achieve the same behavior.
ForwardedValuesis marked as deprecated and optionalin the CloudFormation docs, but if no
CachePolicyIdorForwardedValuesarespecified, the deployment will fail claiming
ForwardedValuesis missing.That's why I opted to default the
CachePolicyIdto "CachingOptimized".fixes #9644
BREAKING CHANGE: Distribution
forwardQueryStringandforwardQueryStringCacheKeyshave been removed in favor ofcachePolicyand the new CachePolicy construct.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license