Caching resources.GetRemote

I am using resources.GetRemote and resources.Copy to get a remote js file that is combined with other JS files only in production (Cloudflare Pages). How do I set cache for such a file between builds?

Not sure if this works

[caches]
 [caches.images]
    dir = ':resourceDir/_gen'
    maxAge = "72h"
 [caches.getresource]
    dir = ':resourceDir/_gen'
    maxAge = "24h"

Cloudflare Pages builds are all unique, or disconnected from each other. Not sure how to express this. But they don’t retain cache from the previous one as Netlify does. So the above should work on your machine and Netlify, but not Cloudflare Pages.

That might have changed, but your struggle seems to suggest otherwise.

1 Like

You are right about the cache issue (it is not yet implemented on CP). But thanks for pointing out that the code is correct. I use Cloudflare due to their numerous pops, otherwise I would use Netlify. I read putting Cloudflare in front of Netlify is not recommended, hence why I moved to Pages entirely.

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