-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great! Couple of minor comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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
ForwardedValues
properties and specifies what parts of a requestmake up the cache key, and what TTLs to use.
Implementation notes:
ICachePolicy
extendIResource
. I admit to not understanding all of theimplications of this, so welcome feedback.
cachePolicyLastUpdatedTimestamp
attribute fromboth
ICachePolicy
andCachePolicy
, as the use case for them isn't clear,and handling the property for managed/imported cache policies was awkward.
forwardedValues
property, forcing users to create (or use managed) CachePolicies to achieve the same behavior.
ForwardedValues
is marked as deprecated and optionalin the CloudFormation docs, but if no
CachePolicyId
orForwardedValues
arespecified, the deployment will fail claiming
ForwardedValues
is missing.That's why I opted to default the
CachePolicyId
to "CachingOptimized".fixes #9644
BREAKING CHANGE: Distribution
forwardQueryString
andforwardQueryStringCacheKeys
have been removed in favor ofcachePolicy
and 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