Caching and Delivery of Updated Files

caching

#1

Am seeking an answer as to why the following happens.

One of the guys working on our website uploaded a new version of a PDF (file name unchanged) to our website. In spite of repeatedly clearing his cache and using multiple browsers to access the site, he could not access the new version of the PDF that he had uploaded. Meanwhile the rest of us on the team all saw the new version the same day. Almost two weeks go by and our friend still keeps pulling up the old version in his browser. While on the phone with the guy, I log in to Cloudflare and purge that specific file from the cache. He then enters the url and walaaa he is pulling up the new version of the file.

My question is: why did I have to purge the Cloudflare cache in order for him to get access to the new file while the rest of us had near instantaneous access to it?

Any insights into this will be greatly appreciated.

Jim.


#2

Cloudflare will cache a PDF on their edge nodes. Each edge node is generally independent of the others, so if it’s cached near one user, it might not be cached at a datacenter near another user.

The edge cache is usually pretty short term, like a matter of days, unless you have a Page Rule that extends the Edge Cache expiration.

So you had to do a network-wide purge to make sure everybody gets the latest version of the file.


#3

Hi, Thank you for that answer. It would seem then that for media files, whenever a new version is uploaded (pdf, doc, ods, etc), I’ll have to do a purge in order to make sure the new version is accessible since the edge cache in question will impact anyone pulling from that particular node.


#4

Wait a second. If we’re using automatic TTL which has a value of like 5 minutes, how can the old version of the file still be in the Cloudflare cache almost 2 weeks later. That does not make sense.


#5

Automatic TTL is a DNS setting, not for when a file cache expires.


#6

A small trick is to append a variable to the url. ex: /media/file.pdf?20180802
That will bypass the original file’s cached version and then become it’s own cached version.

For better SEO (if this is a public file) you should bake the version into the file name. ex: /media/file-20180802.pdf
This way SEs continue to count more content towards your domain. And leave the older versions online (if even not linked to) so that SEs don’t hit a 404 later in time.


#7

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