question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Cloudfront's new cache policy and origin request policy

See original GitHub issue

Recently AWS added a new way to configure Cloudfront’s cache policy, instead of declaring min/max/default TTLs you can create policies (or use predefined ones).

With cache policies we can finally use gzip and brotli compression at the same time (based on accept-encoding header). Brotli is superior in terms of the compression rate, which in end gives us better pagespeed.

Describe the solution you’d like For start it would be enough to support CachePolicyId and OriginRequestPolicyId as cloudfront inputs. When those parameters are declared, TTLs won’t be required anymore.

In the future cloudfront component could take care of creating predefined policies.

Additional context You can learn more about this in AWS reference:

And here’s the AWS brotli-support announcement: https://aws.amazon.com/about-aws/whats-new/2020/09/cloudfront-brotli-compression/

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
danielcondemarincommented, Nov 8, 2020

@otekdo you won’t need to take any extra steps. Brotli will be enabled by default 🙂

2reactions
danielcondemarincommented, Nov 5, 2020

Yeah I’m working exactly on this. Should have something ready this week.

I think it would be easy to predefine new cache policies for some of the behaviours we’ve got as they’re fairly static. If ends up being too much effort I’ll go with a happy medium until we move over to cdk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon CloudFront Announces Cache and Origin ...
Amazon CloudFront's new Cache and Origin Request Policies give you more control over the way CloudFront uses request data to influence both ...
Read more >
Using the managed origin request policies - Amazon CloudFront
CloudFront provides a set of managed origin request policies that you can attach to any of your distribution's cache behaviors. With a managed...
Read more >
What new "Cache and origin request policy" matches our ...
We have been creating CloudFront distributions with the following "legacy cache settings": Open Screenshot Headers: All Query strings: All Cookies: All.
Read more >
CloudFront cache problems and how to solve them
With the new Origin Request Policy, you can setup what elements of the request are forwarded to the origin. This allows fine-grained control ......
Read more >
2. Create CloudFront Distribution - AWS Workshop Studio
Cache key and origin requests > Cache policy and origin request policy (recommended); Cache policy > CachingOptimized (Recommended for S3 origins). CloudFront ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found