On the face of it, yes CloudFront can do what it is you are looking for.
Your starting point of "everything can be cached", yes CloudFront can do that.
Checking for the presence (or absence) of a particular cookie falls under CachePolicyCookiesConfig data type https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CachePolicyCookiesConfig.html
Checking whether any part of the URL matches a specific string would fall under PathPattern within CacheBehavior https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html
- Accepted AnswerMODERATORasked 4 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- I can use my application from a custom origin (EC2 instance or load balancer), but it fails on CloudFront. Why?AWS OFFICIALUpdated 2 years ago
- I set custom object caching on my CloudFront distribution. Why is my distribution using the cache settings of my origin?AWS OFFICIALUpdated 2 years ago
- EXPERTpublished 18 days ago
- EXPERTpublished 2 months ago