Cache not Purging

We released new static json files for our site and purged cache with both the site and api cli. But the old versions of the json files are showing up for everyone on the site. Going directly to the file brings up the correct version. Links/examples below.

Go to and inspect, look at file champions.json which shows url Last modified date is Dec 5th, we updated on the 11th. However if you go directly to and inspect you’ll get the correct version from the 11th. This is happening for all updated files, just giving one example for ease of troubleshooting.

We’ve purged in both cloudflare and cloudfront for this file, not sure why the site is showing diff version from the direct link which is the same as inspector shows for the site.

I’m not exactly sure what you’re saying. There is no link to champions.json on your first link in the source. If the page is populated with data pulled from that Cloudflare isn’t caching it is returning a cache status of Dynamic which means the source for that page is being pulled/generated from/on the origin.

curl -I
HTTP/1.1 200 OK
Date: Thu, 12 Dec 2019 22:01:42 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: __cfduid=d3a9f479a1c4e7c3f231e855a84176bb91576188102; expires=Sat, 11-Jan-20 22:01:42 GMT; path=/;; HttpOnly; Secure
X-Powered-By: Express
Content-Language: en
Vary: Accept-Encoding
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri=“”
Server: cloudflare
CF-RAY: 5442fa77cd59d27a-DFW

Here’s a screenshot of what I was referring to where it looks like the champions.json file is cached from CF from Dec 5th. Screenshot doesn’t fit last modified but it shows 5th on my side.

Sent the curl info to our front end team and they verified that the issue is also present on local dev env which does not have ssr.

Adding some more info. I added the quoted page rule for bypass, purged cache for the same, then visited the page listed in my initial post. The correct version was pulled down. I turned off the bypass rule and the version from the 5th shows back up and is marked as a CF hit.

We’re stuck as our latest site updates are not going out to anyone and we don’t want to turn off caching for these pages as it will be thousands per day to serve. With it happening on local dev and the bypass page rule changing the behavior we don’t believe this is a SSR issue.

You have Origin in the Vary header of your response, which is why you’re seeing two separate cached copies–there’s a separate cache for each value of Origin. If you manually purge the cache for a single URL, there’s a good chance it’s not going to work properly for all possible variations of the header.

This isn’t really a Cloudflare issue; you’re dealing with at least three layers of caching here, sometimes more, and you’re trusting that you’ll be able to force them all to expire prematurely–e.g., by forcing users to manually click “refresh” and by purging a single file through Cloudflare. As you can see, that’s unreliable, and even if you solve this particular scenario, there are others in which it won’t work as expected. That is outside your control and has little to do with Cloudflare. Cloudflare’s cache purge feature is a bit deceiving: it’s not actually going to purge all caches, just Cloudflare’s, and that’s not usually sufficient. It’s useful if you need to make a best-effort attempt to remove illegal content or are actively developing a site, but it’s not useful for regularly changing static resources on a live website–it can’t be; that’s a technical constraint over which Cloudflare has little control.

The correct way to handle this situation is with cache busting. Instead of requesting, request, where someVersionId is changed each time the static files on your site update. A common tactic is to hash the file when building the assets; alternatively, you can manually increment a counter.

1 Like

Thanks for the additional info. I recommended adding version last week and it sounds like that is what our Front End team is going to implement, this should work for us going forward.

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