Force caching of a custom extension

Hi, I need just to add some extension into white-list (e. g. “.json” or null-extension).

The docs of Cloudflare advice me to switch from “Ignore query” (I need it) into “Cache everything” mode, then pay for Enterprise plan, then implement some code on the server, and add some configuration for handling Cache keys.

Wow-wow-wow, but I need just to allow caching of some extension!
All these stuff above if overkill for my small app. My app clearly return required headers saying like “cache it please for 1 week”, but Cloudflare ignores it :frowning:

Any idea how “just to allow caching of .json” for example?

Hi,

You can create a Cache Rule with the expression:

(http.request.uri.path.extension eq "json")

Then set it to Eligible for cache, and make sure to review other parameters (Edge Cache TTL, Browser Cache TTL, Status Code etc.)

1 Like

This worked except all the content my app programmatically marks as non-cachable (using headers) now switched status from always cf-cache-status: DYNAMIC to 50/50 MISS / REVALIDATED, but everything works fine. I will hope there will be no side effects here.

Thank you!