You need the cache to be warmed up by usage. There isn't a way to push something to their CDN. It acts as a caching reverse proxy using their custom nginx fork rather than a traditional CDN that you push to in advance, which I don't think would fit with real-time usage.
Conversation
Replying to
I guess you could log & analyze how they request data from your server to figure a lot of it out.
1
Replying to
They add a CF-Cache-Status header showing whether a cache hit occurred too.
1
1
For example, try this, which should be a HIT:
curl -v "www2.coinbase.com/assets/16x16.p" |& grep -i cf-cache
Then, the following, which should be a MISS:
curl -v "www2.coinbase.com/assets/16x16.p" |& grep -i cf-cache
Then, repeat that request a dozen times and it should become a HIT after 1-3.
1
On that note, I really hate Twitter's link handling... it shouldn't have the ... in the copy-pasted text. They can and should make changes like that with CSS and have it copy exactly as it was entered...
1
So, from client-side testing, if you do a range request for an uncached file, it ends up pulling the whole file and caching that. It isn't quite what they did before. They still only cache files as a whole, but range requests can pull the whole file from the origin to cache it.
1
Replying to
Is the range request by any chance satisfiable before the whole file finishes transferring?
2
Even if so, this sounds like Cloudflare would badly pessimize a site where most requests are small range requests.
1
Replying to
Yeah, it still handles this very oddly, because their caching still seems totally incapable of caching a portion of a file. Would need to test with a large file to confirm that it doesn't just want to cache large chunks though.
It also matters what happens if requests are made for content that's already being pulled from the origin server. I don't think it's nearly as clever as people would expect at being able to merge new requests with currently pending ones, at least for ranges.
1
1
They use a fork of nginx and relevant option is nginx.org/en/docs/http/n. I think the range option might also explain the range handling:
nginx.org/en/docs/http/n
i.e. I think it caches a certain amount of the start of the file, but not arbitrary sub-ranges within it.
1

