R2 is my origin server for media files. I follow a pattern of: (a) try optimistically to hit the CDN URL, (b) set “onerror” to javascript that posts the media to the R2 if it wasn’t there, and (c) now anticipate a 200 at the URL. However, a Page Rule that results in use of the CDN also caches the 404. Can I use a CDN for my pattern?
Thanks! I guess there’s some interplay between Page rules and Cache rules, right? Does this seem reasonable for my use case above?
Page Rule: https://mydomain.com/*
Browser Cache TTL: a day, Cache Level: Cache Everything, Edge Cache TTL: a day
Cache Rule:
If custom filter (hostname = mydomain.com) then eligible for cache “Use cache-control header if present, use default Cloudflare caching behavior if not”, Status Code TTL code 404 No Cache.