Cloudflare and caching images?

It means "expire immediately" -- which causes the browser to revalidate. If the image hasn't changed, a 304 "not modified" is returned when the browser asks for it again. This is just what we expect when the plone.app.caching rule is set to weak (or moderate on the public side of a shared cache).

This is a typical rule for an image content item. It allows for the possibility that the image may have been changed without the URL having changed. Use strong caching if there is a reliable expectation that such content items never change.

1 Like

maybe

if ($request_uri ~* "(@@images/image/preview|@@images/image/large)$") {
expires 365d;
add_header Pragma public;
add_header Cache-Control "public";
in nginx

But cloudflare still not cache except file name end with JPG / PNG / Webp etc.

Short:

Never use @@images/FIELDNAME/SCALENAME but use the API to get the scale UID-URL @@images/SCALEUID. Latter is a unique URL for the current upload. If you override an image, URL changes.

Then - given the caching profile is loaded correctly - the caching headers and whatsoever needed should be set right and Cloudflare is happy too.

Thx can you show me how to do that btw which cache part of cache setting is belong to @@image I cannot find in control panel

Cloud flare still cf-cache-status: DYNAMIC

for @@images/image/large

even the expires: Thu, 28 May 2020 07:09:35 GMT

Control Panel > Caching > Detailed settings > Content files and images > Maximum age 31,536,000

What do I doing wrong?