[cloudfront] Cache Policies for CloudFrontWebDistribution
See original GitHub issueSupport for Cache Policies was released for the Distribution
construct in #10656. This feature request tracks porting that same support over to the CloudFrontWebDistribution
construct.
Use Case
For users of the stable CloudFrontWebDistribution
construct who want to be able to control the cache key and TTLs.
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:24
- Comments:10 (4 by maintainers)
Top Results From Across the Web
class CachePolicy (construct) · AWS CDK
Using an existing cache policy for a Distribution declare const bucketOrigin: origins.S3Origin; new cloudfront.Distribution(this, 'myDistManagedPolicy' ...
Read more >javascript - How to set CachePolicy in cloudfront using CDK's ...
I am trying to set CachePolicy, OriginRequestPolicy and ResponseHeaderPolicy using CloudfrontWebDistribution Construct.
Read more >CDK pattern – Caching static assets with AWS S3 and ...
In the AWS ecosystem, we need to store the files in S3 and set the cache-control header to tell the CloudFront distribution how...
Read more >aws.cloudfront.Distribution - Pulumi
Creates an Amazon CloudFront web distribution. ... The unique identifier of the cache policy that is attached to the cache behavior. compress boolean....
Read more >@aws-cdk/aws-cloudfront - npm
You can use a cache policy to improve your cache hit ratio by controlling the values (URL query strings, HTTP headers, and cookies)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I switched to this construct because the Distribution construct doesn’t have custom origin headers, but now I don’t have automation for setting cache policy.
CfnDistribution
is an L1 construct where asCloudfrontWebDistribution
andDistribution
are L2 (opinionated) constructs. Typically,Cfn*
constructs are used as a last resort.Here is an example attaching lambda@edge function to a CF distro. Note that this is an experimental functionality. However, we’re using it in prod and so far it’s been really good. Also, CloudFront functions are a new thing (https://aws.amazon.com/blogs/aws/introducing-cloudfront-functions-run-your-code-at-the-edge-with-low-latency-at-any-scale/)… it’s worth taking a peek at those if you haven’t already.
I’ll have to test custom headers on S3 origins for a bit… but I bet you can use escape hatches to apply those if they’re not officially supported yet. (https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html)