Amazon CloudFront CDN caching guide
Amazon Web Services · reviewed against the vendor documentation listed below
How Amazon CloudFront caches: X-Cache and log result types, cache policy TTLs, invalidation by path or tag, Origin Shield and per-edge cold starts.
Part of the Top 10 CDNs in 2026 comparison. New to the topic? Start with why cache warming matters.
Caching at a glance
- Cache status on the response
X-Cache(for exampleMiss from cloudfront) andx-amz-cf-popfor the edge location. Access logs record the detailed result type inx-edge-result-type(Hit,RefreshHit,Miss,Errorand others).- TTL controls
- Cache policies set minimum, default and maximum TTLs.
s-maxageandmax-ageare honored within those bounds; a minimum TTL above 0 caches responses even when the origin sendsno-cache,no-storeorprivate. - Purge
- Invalidation by path, with
*as a wildcard (a wildcard path counts as one path), and invalidation by cache tag. Invalidated objects are removed, so the next request goes to the origin. - Tiering and origin protection
- Regional edge caches sit between edge locations and the origin, and Origin Shield adds one more caching layer that consolidates requests for the same object.
- Edge compute
- CloudFront Functions and Lambda@Edge.
Strengths for caching
- Origin Shield consolidates simultaneous requests for an object that is not in its cache, which protects the origin after an invalidation.
- Supports
stale-while-revalidateandstale-if-errorfrom the origin'sCache-Control. - Invalidation by cache tag, alongside path invalidation.
Watch-outs
- CloudFront caches an object only in the edge location that received the request; another edge location still returns
Miss from cloudfrontfor it. - No soft purge: an invalidated object is fetched again from the origin on its next request.
- The response header shows hit or miss; the detailed result type is in the logs.
Cache warming on Amazon CloudFront
AWS states the cold-start problem directly: CloudFront caches an object only in the edge location that received the request. A warming request from one location fills that edge location (and the regional edge cache and Origin Shield behind it), not the others. Warm from the locations your visitors use, and check x-amz-cf-pop to see which edge answered.
Origin Shield is what makes warming pay off across locations: once the shield holds a page, a cold edge location fills from the shield instead of the origin. See tiered caching.
curl -sI https://d111111abcdef8.cloudfront.net/ | grep -iE '^(x-cache|x-amz-cf-pop|age)'
# x-cache: Miss from cloudfront
# x-amz-cf-pop: <edge location code>Check the cache policy before warming. If the minimum TTL is 0 and the origin sends no-cache, CloudFront revalidates every request and warming has little effect. The Top 10 CDNs comparison lists the criteria behind CloudFront's position.
Frequently asked questions
Why does CloudFront return Miss from cloudfront for a page I already requested?
CloudFront caches an object only in the edge location that received the request. A request routed to a different edge location misses until that location has fetched the object.
Does a CloudFront invalidation serve stale content while it refetches?
No. An invalidation removes the object, so the next request goes to the origin. Origin Shield reduces how many of those requests reach the origin at once.
Related terms
Amazon CloudFront documentation
- AWS re:Post: X-Cache Miss from CloudFronthttps://repost.aws/knowledge-center/cloudfront-x-cachemiss-error
- CloudFront: Standard log file fieldshttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/standard-logs-reference.html
- CloudFront: Understand cache policieshttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cache-key-understand-cache-policy.html
- CloudFront: Manage how long content stays in the cachehttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html
- CloudFront: Invalidate fileshttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
- CloudFront: Invalidation by cache tagshttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/invalidation-by-tags.html
- CloudFront: Origin Shieldhttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
- CloudFront: Edge functionshttps://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions.html
Warm your cache after every deploy
sitewarm requests the pages in your sitemap after a deploy and reports the cache state the CDN returns for each one, with the vantage point it was measured from.