Cloudflare file cache check if file size change get new file

Hi,
Cloudflare cache my .zip files but when I reupload my .zip file with new one, Cloudflare didn’t purge the cache automatically and show the new one to users.
what is the best solutionto tell Cloudflare to check if a file change gets the new file?

You need to make sure the origin server sends the proper Cache-Control header with your file. You may want to try “must-revalidate” or "proxy-revalidate:

I use this:

Header set Cache-Control “must-revalidate”

I need something to tell Cloudflare to clear the cache file on a new upload.

For example, Cloudflare chahe test.zip, now I upload a new test.zip and overwrite the old version, but Cloudflare doesn’t clear the test.zip cache and get the new one.
how can I do this?

Create a Cache Rule with

Browser Cache TTL: Respect existing headers
Edge Cache TTL: Respect existing headers

Set cache-control header with max-age=seconds-in-browser and s-maxage=seconds-in-Cloudflare-cache, as well as must-revalidate.

Ex:

Cache-Control: max-age=3600, s-maxage=7200, must-revalidate

This will tell the browser to keep the file in cache for 1 hour, and CF to cache it for 2 hours, but on condition that they are revalidated.

For revalidation to work properly, your origin must send at least one of these headers: Last-Modified, E-Tag. Otherwise, Cloudflare will add a Last-Modified date at the time the file is first cached by Cloudflare.

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