Cloudflare CDN: limit on images?


#1

Hi there!

I am looking to use Cloudflare CDN for a site which will have quite a lot of images. I wanted to first check if this is allowed. I’ve already done some research, and found this post.

The answer is: “No, Cloudflare only caches what you already have on your site.”

This answer seems quite unclear. What if there are already images on a site? The response implies that a website only consists of HTML content, with media only being sourced from external sites.

Because the answer seems unclear, I’m posting this question, hoping to find a more definite response. My site will have images alongside HTML and other content, and there will be quite a lot of images, and quite a lot of requests for those images. Does Cloudflare CDN allow the site to have images? Do they cache images? Is there a limit of data charges for the caching of these images?

Thanks for your time.


#2

That was my response. The term “Image Hosting” implies someone wants to manually upload images to Cloudflare. I didn’t hear back from the poster, so I could have misinterpreted their question. Which is why I used the term “caching.”

When a visitor visits your site, your site content is routed through Cloudflare. Cloudflare will cache static content, including images, for a limited time.

To answer your question, you’ll be fine, and not incur any additional charges. Cloudflare will cache a lot of images, but don’t expect it to be unlimited. Cloudflare will also cache CSS and JS, and many other filetypes.

At some point, your earliest unused cached content will be flushed and re-cached next time it’s needed.


#3

At some point, your earliest unused cached content will be flushed and re-cached next time it’s needed

That’s interesting. How does that work? Is there a time limit, or maybe a limit on the total size of all cached files?


#4

I don’t know, but it’s not surprising as it’s not a good use of Cloudflare resources to cache stuff that’s rarely used. I have “Cache Everything” set on many of my sites with an Edge TTL of a month. On low traffic sites, some assets just aren’t cached for the full month. I realize there are multiple Edge servers, but for a site that’s hit on a regular basis, some stuff just doesn’t stay cached. 1 year cache control, yet turns up as EXPIRED.


#5

It is very “set it and forget it”. You really don’t need to think about it because they will automatically cache what needs to be cached. Images that are being requested frequently end up in the cache and images that aren’t well they are accessed infrequently so the bandwidth occurred is minimal.