Cloudflare MISS but CloudFront HIT for static assets with correct Cache-Control hea

What is the name of the domain?

decksaver.com

What is the issue you’re encountering

We’re using Cloudflare in front of a CloudFront distribution that serves static assets (mainly .png and .jpg images) from an S3 bucket. These are requested from the media. subdomain, which has a CNAME record pointing to the CloudFront distribution domain. The assets return correct Cache-Control headers (max-age=2678400), and CloudFront responds with x-cache: Hit from cloudfront, confirming they’re cached at that layer. However, Cloudflare consistently returns cf-cache-status: MISS. We’ve tested with no cookies, no query strings, and standard content types (image/png, image/jpeg). We’ve also tried applying cache rules in Cloudflare based on file extension and hostname, but the assets still aren’t being cached. We’re trying to understand why Cloudflare is skipping cache and what adjustments are needed to get reliable edge caching for these static images.

Do you have an example URL to such an image?

There’s also currently a bug with the cache that’s already being worked on, see here:

Thanks for your reply, an example URL for an image is https://media.decksaver.com/uploads/2020/10/DS-PC-TB303_FRONT_x9lwey_wrpuus.png

Thanks for sharing the thread about the bug too

1 Like

And just to confirm, you don’t have a cache rule that limits the Edge TTL to a few seconds? I see that the image is cached for a very short time, before it’s seemingly purged again after ~2 seconds.

I can confirm we don’t have a cache rule for that in place

If relevant, we have Automatic Platform Optimization (APO) turned on

Do you have any Cache Rules?

Can you share your other Cache settings as well? I’m trying to reproduce the issue, but so far everything works for me.

Would you also share your server’s Cloudfront address with me via a private message so I can check what headers your server sends and which are added by Cloudflare?