Cloudflare not caching images

I’m having issues while trying to configure Cloudflare to cache images from my website.

This is the website:
It’s hosted by the GitHub Pages Server (

This is the only Cache Rule I’ve set up:

I also tried changing the rule to several ors to check for each specific extension. Something like:

(http.request.uri.path.extension eq "jpg") or
(http.request.uri.path.extension eq "jpeg")

but that didn’t work either :frowning:

I don’t have any other Cache Rule or Page Rule.

So I expect any URL ending with jpg, jpeg, etc. to be cached.

But every time I navigate through the web browser I see all the images have the GitHub Pages Server cache-control value, 10 minutes.

I tried to check what’s the raw header values coming from GitHub Pages Server by issuing this command:

curl -svo /dev/null

From the output of that command I get the same cache-control value, 10 mins (cache-control: max-age=600 :

< HTTP/2 200 
< server:
< content-type: image/jpeg
< last-modified: Fri, 16 Feb 2024 20:01:42 GMT
< access-control-allow-origin: *
< etag: "65cfbf26-af1b"
< expires: Fri, 16 Feb 2024 21:31:17 GMT
< cache-control: max-age=600
< x-proxy-cache: MISS
< x-github-request-id: C450:1B9D02:15EF99:165485:65CFD1CD
< accept-ranges: bytes
< date: Fri, 16 Feb 2024 21:21:17 GMT
< via: 1.1 varnish
< age: 0
< x-served-by: cache-mad22072-MAD
< x-cache: MISS
< x-cache-hits: 0
< x-timer: S1708118478.801899,VS0,VE192
< vary: Accept-Encoding
< x-fastly-request-id: e780cb19ad26f0d9de55875608af1baabed20349
< content-length: 44827

What am I missing here, what’s the correct way to cache images through Cloudflare?

I just started today and read a bunch of documentation but I don’t seem to find the root cause of this issue.

This is the rest of the screenshot for the cache rule (I can embed only one media type cuz I’m a new user)

And this is the request in the browser:


first of all, Cloudflare caches images by default, so you shouldn’t need that Cache Rule.

Second, your website currently isn’t working at all. I see ERR_TOO_MANY_REDIRECTS when I try to open it, which is usually caused by using the Flexible SSL option in Cloudflare. Please try to change that to Full (strict).

From your curl, I can see that your request isn’t going through Cloudflare at all. You probably still have cached DNS entries pointing directly to Github on your system.


Hi @Laudian ,

Right on spot!
That was the actual issue… the wrong “SSL/TLS encryption mode”. Somehow it was affecting the caching.

I just moved yesterday to Cloudflare and I was trying to figure everything out.
I also noticed the “too many redirects” from time to time, but didn’t have the time yesterday to investigate as it was around 23:30, my time.

After setting the correct encryption more the Cache Rule started to be taken into account.
As I understood from you, that shouldn’t be necessary to cache images, so I went ahead and removed it.
Now the resources are being cached properly, following the default cache configuration.

Thank you very much for your prompt and accurate message!

1 Like

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