Cache Rules don't work when origin Cache-Control is set

When setting up Cache Rules and my origin responds with a Cache-Control Header then cloudflare will always use that, even when specifying Ignore cache-control header and use this TTL in the rule settings. I've attached a screenshot of my settings, the cdn subdomain is pointing to digitalocean spaces which sets a Cache-TTL of one minute. So even with those settings telling it to overwrite the TTL with 3 hours it still uses 60s instead. Any idea how I can resolve this? 🙏
No description
11 Replies
warflash
warflashOP4mo ago
By looking at the response headers of the request. It returns a max age of 60 and shows MISS after 60 seconds
No description
warflash
warflashOP4mo ago
But the checkbox literally says "Ignore Cache-Control header and use this TTL" 🤔
Chaika
Chaika4mo ago
There's a Browser TTL option in Cache Rules but just overriding Edge just overrides it on edge That option is just saying "for edge cache, use this ttl and ignore the cache-control header", it's not going to override it
Chaika
Chaika4mo ago
Browser TTL below is modifies the cache-control the user gets
No description
warflash
warflashOP4mo ago
I don't think I understand tbh. Say I specify Ignore Cache-Control header and use this TTL and set it to cache at the edge for 3 hours. How come I get cache misses after 60 seconds? Like clearly it's not caching for 3 hours then right? Browser Caching is not really something I'm too worried about, at the moment I'm just trying to make cloudflare cache things on the CDN side of things for custom durations, ignoring headers sent by the origin
Chaika
Chaika4mo ago
Either your rule isn't matching or you're hitting diff cloudflare PoPs (somewhat unlikely). Run the URL through trace (account level) and/or share the url that should be cached for 3 hours here
warflash
warflashOP4mo ago
I tried tracing it but unfortunately you can't seem to do that for subdomains? I verified the PoP being the same through the headers. I'll grab a quick example url, 1s
Chaika
Chaika4mo ago
you def can use on subdomains, did you specify the full url including the scheme/https://? if it doesn't work and doesn't apply this smells like a cf for saas thing. What's the host of the subdomain/the thing you're pointing to?
warflash
warflashOP4mo ago
I've read about SaaS but I don't see how that affects us. Subdomain is cdn.questlog.gg, pointing to a Digital Ocean Spaces Bucket. Okay I do have a suspicion Okay yeah my bad. The trace did not work because the subdomain was DNS only, not proxied by cf. I don't understand how things we're cached by CF at all then but yeah. With the trace working it lead me to a mismatched cache rule that overwrote the settings and told it to bypass
Chaika
Chaika4mo ago
Ah yea makes sense, I did check if it was proxied or not after you said it was DO but you must have done it before
warflash
warflashOP4mo ago
Yep, thank you! I guess that'd be a nice piece of feedback in case champions/mvps got a more direct line to product management. Showing when a traced hostname is set to DNS only would help a lot with diagnosis 🫡
Want results from more Discord servers?
Add your server