Questions about caching

I see there is a setting to select a default Browser TTL, but how do I set the default Edge TTL? I’m probably just missing it, or maybe I have to set up a custom Rule in order to set this?

Also, we use a MS server running and utilize “bundling”, which automatically minifies and bundles all CSS and JS files and serves then this way from the Origin. The URL is …/bundles/CoreStyles?v=1skgTg-AkbuUPr9cKxtxELQRE9cQfpbr1GnNuXAn99g1 and …/bundles/CoreJs?v=MLrLfy-9iRaNsDzziNlVdEMUjE9NlHpqvsJjPRmCX-w1 (where “…” is the root domain of the website).

My question in this second part is how I get CF to cache those JS and CSS files? For some reason the headers of these files shows “DYNAMIC” and they simply will not cache, even when I set a Cache Rule for them. Any ideas? Unfortuantely you cannot change the folder where these bundles reside - MS sets the folder to “bundles”.


Edge TTL just can be set if the ressource is beeing cached. The ressource you show is does have the header cf-cache-status set to DYNAMIC which means, it is getting proxied and not cached. Therefore not Edge TTL can ever be applied.

To cache this, make it cachable by:

  • fileextension (this is stupid, but this is how Cloudflare works)
  • PageRule that forced edge Cache for .../bundles/*

Then apply the Edge TTL - maybe even in the same Rule, that forces .../bundles/* to be cached.

Thanks for the response @M4rt1n. I actually figured this out a couple of days ago. I actually found that by setting up the Cache Rule for "…/bundles/* " with then setting the “Cache Level” option to “Cache Everything”, it worked to cache the files under that folder. Since I’m ok with that (with CF caching all files beneath that folder), it works for my needs.

I left this thread open in case someone has an answer to my first question. Can you answer this?..

CF automatically caches assets like CSS and Image files if you simply turn on Caching from the Caching > Configuration settings, which we’ve done, and CF is indeed doing. However, under Caching > Configuration there is only a TTL option for “Browser Cache TTL”, nothing for “Edge Cache TTL”, so there is nothing to tell the Edge how long we’d like for those assets to be stored before refreshing the Edge cache.

So my question is, how is Edge Cache TTL set for everything that does NOT have a specific Cache Rule set? Will it work to simply set a blanket rule (e.g.* ) with an Edge TTL setting alone? I just worry that will adversely impact other rules if I do so, but it seems the logical option.

Yes, that should do the trick. Just keep in mind, that PageRules will be executed in order and just one PageRule applies at a time.

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