JS/CSS won't uncache without a purge
Even after the weekend, my JS/CSS files for my Pages deployment are still being cached. I have to run a Purge Cache on those files on every deploy to get them uncached. I thought a deployment would automatically clear those files from the cache.
Any strategies to fix this issue? Is it common and I just don't know what to search for? Thank you!
8 Replies
Thank you. Is this something that everybody does? Is this a common issue?
I think I'm facing a similar issue, I noticed one user is still getting served stale data that was updated almost a week ago. Just added the cache rule as well so we'll see if that fixes anything. How are you able to see if the files are uncached?
Check the
CF-Cache-Status
header
Not explicitly, though sometimes you may have another cache rule, or something else causing assets to be cached when they shouldn’t beit's set to
DYNAMIC
but I also see Cache-Control: no-cache
which wasn't there before, promising!
but I find it hard to believe that without that cache rule a user would cache the request for nearly a week now
I did see these 2 fields that have max_age of 7 days 🤔 but they seem like irrelevant fieldsJust to check, can you see if it is cached on their device?
Adding a Cache Bypass does not prevent client-side caching, unless you explicitly enable it. And even then, it will only apply when the asset in question is refetched
no is there a way I can do that? the way I'm determining that now is with inconsistencies in their database entries that make it apparent they are using outdatated data from 6 days ago
My issue was fixed when I purged the cache, so it wasn't a client-side cache causing the issue. I'll add a rule I guess.