Are these files cached by default?


#1

My website users many libraries hosted by my server. For example, in index.html, they are referred as follows:

<script src="/libs/jquery-ui.min.js"></script>
<script src="/libs/angular.min.js"></script>
<script src="/libs/angular-ui-router.min.js"></script>

My question is, if I choose “Standard” as “Caching Level” in CloudFlare, are these files cached?

If not, the only way to cache them is creating “Page Rules” and “Cache Everything”?


#2

@chengtie all static content (which includes .js files) are cached as default with the standard cache level. For more information take a look at the KB here:

What file extensions does CloudFlare cache for static content?

Also if you want to test / check this, see: How can I tell if CloudFlare is caching my site or a specific file?


#3

I notice that the definition of Standard / Aggressive is Delivers a different resource each time the query string changes. But I don’t see query string for those js files, and I don’t see the change of the query string either.

Could you explain that?


#4

If you are requesting the same file with different query strings, for example:

example.com/test.js?some-query-string=1
example.com/test.js?some-query-string=2
example.com/test.js?some-other-query-string=1
example.com/test.js

And you wanted them all to be served from one cached item, you would choose the “Ignore Query String” setting. If you leave your setting at Standard, all 4 of those URLs would create a unique entry in cache.

For more information click “Help” under the cache setting in the dashboard or visit the KB:


#5

This topic was automatically closed after 14 days. New replies are no longer allowed.