Help with cache

When a user deletes an image from my server, it can still be viewed because of cloudflare cache. When I click on the purge cache button on cloudflare, the image is removed. Is there anyway to fix this behaviour without removing caching? is there anyway i could send a signal to cloudflare automatically to remove the cache?
10 Replies
CatNoir
CatNoirOP•7mo ago
i think i ended up disabling the cache all together 😩
Idle
Idle•7mo ago
https://developers.cloudflare.com/api/operations/zone-purge or just... have cf respect your origins cache ttl and serve the image with a low ttl? using the cdn for image storage without a corresponding plan is also against cf tos i think
CatNoir
CatNoirOP•7mo ago
oh fr? 😭 i did try making cf respect my origin but it doesnt work
Idle
Idle•7mo ago
you need to explicitly do that in your cache rules
CatNoir
CatNoirOP•7mo ago
oh wait, if theres no ttl, does it cache for a long time? oh
Idle
Idle•7mo ago
if you don't provide a ttl then cf will use its default ttl or any other ttl that is set in your cache rule
CatNoir
CatNoirOP•7mo ago
i see im guessing youre talking about "max-age" header right?
Idle
Idle•7mo ago
yep
CatNoir
CatNoirOP•7mo ago
i see ill set it to 5 minutes (300)

Did you find this page helpful?