How do I stop Cloudflare from caching images if the server was temporarily unavailable? Basically, I have several images that are displaying a 522 error, and it’s because that response seems to be the cached response.
I wrote a temporary page rule to bypass that image in the Cloudflare cache and go straight to the server and voila, the image loads right up. I turn the bypass back off for that image, and voila, the 522 error comes right back.
So what appears to have happened is that the server was down for a minute during which time Cloudflare attempted to fetch that image. It was unable to reach the server so it generated, and then cached, a 522 error. I don’t want the image added to the cache if it is a 522 error. It should be bypassing the cache until it actually gets a response.
Is it somehow possible to always bypass the cache/don’t put files in a cache if they generated an error? How do I accomplish that?