My origins temporarily returned 404 for an image url for some reason.
This result seems to have been cached by Cloudflare for several days.
I tried to fetch the image directly from the origins. This worked fine.
And after purging this specific url from the CF cache, things are looking good.
But why would Cloudflare cache a 404-result for many days?
There are two reasons I can think of. The first is that your Origin gives a very long
cache-control: max-age value on the 404. The second is that you have a Page Rule that tells Cloudflare to cache the “file” for a very long time.
There is no easy rule-of-thumb on caching errors. Sometimes is is a good idea, sometimes not. Enterprise plans can set a page rule to set the Cache TTL by status code, in other cases I find that relying on Origin cache control is the best solution.
Thanks for your answer.
The Browser Cache TTL is set to 30 minutes in Cloudflare. As far as I can see this is the only configuration we have. This makes it even stranger.
I am new to Cloudflare, so I might be looking in the wrong place…
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.