Unable to properly cache my static page

Hi,

I am starting to use Cloudflare with Amazon S3 storage, and I think I have everything setup correctly, but I can not make Cloudflare to cache my static page properly.

Here is my setup, on Amazon S3:

  • Marked all the files with meta “Content-Type” : “max-age=604800” (around a week in seconds)

On Cloudflare:

  • Caching Level: Standard
  • Browse Cache TTL: 8 days
  • Page Rules: marti.works/* Cache Level: Cache Everything (as the first rule)

With this setup, and knowing that the page content does not change over time, it only contains static HTML, CSS, and some images (PNG, SVG, …), also knowing that the whole page is about ~7MB in size. Accordingly to the Cloudflare overview:

  • Unique visitors: 367
  • Total requests: 3,609
  • Percent Cached: ~53.69%
  • Total Data Served: 38MB
  • Data Cached: 21MB

What I am missing ?

Thanks for the help and time! :smiley:

All the resources in your domain are cached by Cloudflare. That doesn’t mean it stays in Cloudflare’s cache forever. Least-used resources are evicted early from the cache. And every edge server at Cloudflare caches independently, so geographically different users have different caches. Those reasons are why it’s hard to get a high cache hit ratio.

Hi sdayman!,

Thanks for your explanation. If I understood correctly, this means that, for example, a file served from an Amazon S3 server with a meta tag of max-age=<8 days> is going to be cached by Cloudflare but it is not guaranteed to be cached for those ~8 days, and the cache can drop that cached file, for example, after only 2 days.

Is my understanding correct ?

Thanks in advance! :smiley:

1 Like

Yup, you’ve got it!

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.