Cache images only

How can I cache only my images?

Thanks.

Cloudflare, by default, doesn’t cache anything dynamic like your web pages, so that’s already covered. The only thing is that everything on your website indeed will end up proxied, which isn’t something you can control on a per-file basis (due to how DNS and DDOS protection works).

However, if they don’t want other static files cached, I think it’s a bit trickier.

I think the easiest way is to set cache headers per filetype at the server.

1 Like

Set cache headers per filetype at the server? Can you unpack that please?

Modify the HTTP headers and add cache-control instructions on what should and should not be cached, and how long cached files should be valid, etc.

Read about cache-control headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

And try a search for tutorials and guides specific to Cloudflare, cache-control and HTTP headers.

1 Like

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