Hey,
I am using Cloudflare to be used as a CDN for my images(stored in s3) to save some bandwidth. All my images have a unique path(eg: imag1/-32893289-unique-adds/img1.jpg). Now let’s say someone tries to access an image from s3 which does not exist as of now, so for that, I have a setup such that for a key not found s3 will return 404 status and an default image.Now what is happening is let’s say my system request for an URL that does not exist as of now, so Cloudflare will cache it as a result for that URL, now let’s say after two minutes that URL starts to exist, but Cloudflare will return the 404 for that as it has saved the result in its EDGE location for that URL.
So I need to know if we can control the browser cache and EDGE cache of Cloudflare based on the result obtained from the origin server?
404 responses are cached for five minutes by default
https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-Cloudflare-What-to-Cache-
Hey,
Thanks for the answer. I have one more related question on this, the Cloudflare will cache the 404 responses for five minutesbut how to change the browser cache details for that because I am seeing that Browser Cache Expiration is not changing for the 404 responses ?
Thats something you need to do on your server side. Alternatively you could also set up a page rule which overrides the settings.
Can you please suggest using page rule how can we change the browser’s TTL based upon the response header of the origin server?
https://support.cloudflare.com/hc/en-us/articles/218411427 should have all the details.
This topic was automatically closed after 30 days. New replies are no longer allowed.