Almost no images being cached. Drupal website

I have a website that serves quite a few images. I am trying to cache as much as possible as my host charges for bandwidth. I have a page rule to cache everything:

I have also tried creating a cache rule that caches jpg’s.

Either way, if you look at a page like this https://www.harappa.com/slideshows/around-indus-90-slides none of those image are being cached.

Why? What do I need to do to make sure all my images are cached?

You actually don’t need a cache-everything page rule for images. Cloudflare caches static files by default. A cache-everything rule will also cache your HTML, which is not cached by default.

I see all your images as HIT after the second or third request of the same page.

But please understand that Cloudflare has a cache eviction policy where infrequently visited files get dropped from the cache regardless of the Edge TTL set by your settings. So if you visit a low-visitation page, you might face lots of uncached images (those that are exclusive to that page), that will then be re-cached as the page gets more visitors.

1 Like

thanks for the info @cbrandt! This was what I was thinking was the case.

Now if I am wanting to reduce requests to origin as much as possible, what would be the best approach?

Would it be something like pre-warming cache for top X posts?
Would it be paying for cache reserve?

Thanks :pray:

That could help you. Make sure under Cache > Tiered Cache you have Tiered Cache enabled, as Cloudflare keeps cache on more than one of its 300+ datacenters depending on where the visitor came from. You may want to have a look at this script by @eva2000 that allows you to make calls to page test apis from different locations.

I’m not familiar with either Drupal or R2 to make any significant comment, but here’s the R2 blog announcement, see if it fits your goals:

thanks so much, @cbrandt. You have been a huge help :pray:

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.