PDF file gets uploaded to same URL, cache not immediately updated

A website that I have on Cloudflare (Pro plan) offers PDF downloads under URLs like this:

These files need to be updated to new version occasionally while keeping the same name.

We have an admin that looks after files uploads, website content updates, etc. and she complains that after she uploads new PDF files with the same name and test downloading them, the old files are being downloaded.

I suspect that Cloudflare cache does not get updated immediately after the new files are uploaded.

What can I do about this without sacrificing overall website cache performance? Current caching level is Standard and Browser Cache TTL is 4 hours.

Two ways I can think of is to create a page rule for the path mysite.example.com/storage/content/corporate/* and bypass the cache or set Browser Cache TTL for this path at 30 minutes (minimum value). Both methods aren’t ideal as they defeat the purpose of caching. What I am really looking for is how to automatically update cache immediately after new files are uploaded without purging cache manually every time.

Thanks.

It’s the Edge Cache TTL you’d need to change. But I’d certainly drop browser cache TTL to the minimum since it’s just a PDF and people really aren’t looking for performance.

You’d have to script this at your end and make an API call.
https://api.cloudflare.com/#zone-purge-files-by-url

1 Like

Thanks. I’ll try lowering Edge Cache TTL and Browser Cache TTL for the PDF directories.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.