Cloudflare "Bypass" all the static images (Except for Safari)

What is the name of the domain?

deluxeside.com

What is the issue you’re encountering

Cloudflare never caches images on the site. Chrome says “BYPASS” or “MISS” while Safari says “HIT” for the images.

What steps have you taken to resolve the issue?

I checked my server configuration, disabled the WebP plugin, temporarily turned off the Polish and Mirage… None of them fixed the issue. That’s a very strange issue that has never happened before. If you visit the page via Safari, CF-Cache-Status is set to “HIT” but not working on Chrome.

The issue does not happen on other static files (css, js, fonts, etc), and also we use Cloudflare APO. The HTML pages are cached successfully.

Any idea?

Screenshot of the error

I just created this specific cache rule for image extensions (jpg, jpeg, png, webp, and gif) via Cloudflare Dashboard, it still doesn’t cache the images at all. I don’t know what to do… It might be a Cloudflare bug?

Any help please?

Definitely not a bug. Those resources cache:

> GET /wp-content/uploads/2025/02/jordan-1-1-150x150.png HTTP/2
> Host: deluxeside.com
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/2 200 
< date: Sun, 09 Mar 2025 21:32:56 GMT
< content-type: image/png
< content-length: 3044
< cache-control: max-age=31536000
< cf-bgj: imgq:85,h2pri
< cf-polished: status=not_needed
< etag: "67ae0ff1-be4"
< expires: Mon, 09 Mar 2026 21:32:53 GMT
< last-modified: Thu, 13 Feb 2025 15:29:53 GMT
< vary: Accept
< cf-cache-status: HIT


> GET /wp-content/uploads/2023/02/8d089ab9.jpeg HTTP/2
> Host: deluxeside.com
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/2 200 
< date: Sun, 09 Mar 2025 21:34:32 GMT
< content-type: image/jpeg
< content-length: 33502
< cache-control: max-age=31536000
< cf-bgj: imgq:85,h2pri
< cf-polished: degrade=85, origSize=221774, status=vary_header_present
< etag: "67ac0285-3624e"
< expires: Mon, 09 Mar 2026 21:34:29 GMT
< last-modified: Wed, 12 Feb 2025 02:08:05 GMT
< vary: Accept
< cf-cache-status: HIT

You shouldn’t need a rule. Those extensions are cached by default:

https://developers.cloudflare.com/cache/concepts/default-cache-behavior/#default-cached-file-extensions

First, remove that rule, as it’s not necessary.
Second run a request through the Rule Tracer to see if there are any other rules that are applying to those files.

Also keep in mind that you may be seeing a BYPASS because your browser’s Dev Tools is set to Disable Cache.

First of all, thank you for your help! Are you 100% sure all of the images are cached?

The rules I added do not affect the images at all. I mean they’re not working at all, I can’t even replace the “Cache-Control” header via Cloudflare browser rules. I’ve disabled the corresponding rule and also Dev Tools is NOT set to “Disable Cache”.

I usually use HTTP response header check | Uptrends that tool to check the headers from different locations. As you see, they’re not cached and always say “MISS” for the images.

On the other hand, if you check other websites that use Cloudflare CDN, The CF-Cache-Status header always becomes “HIT” for images. You can check it by using an image link from your personal blog for example.

Let me show you with an example:
I just checked the HTTP headers of the site logo 10 times, it always says “MISS”:

I created a staging site by cloning the production site (staging2.serdarwork.com), added it to another Cloudflare account and checked the HTTP Headers for the same logo, and it works perfectly:

So, if you even check the HTTP headers of the production logo 100 times, it will always say “MISS” in any tool. You can test it with your tool. I think this is a very strange issue!

  • Cloudflare APO is working smoothly,
  • Cloudflare successfully caches all the other static assets (CSS, JS, fonts, etc.)
  • I checked my Cloudflare settings and web server configuration many times

Please post actual URLs, so we can test the issues you are seeing. Assuming I found the right URL for your site logo, I get a HIT on my second request:


15:13:20 % curl -svo /dev/null https://deluxeside.com/wp-content/uploads/2025/02/deluxeside.png
…
> GET /wp-content/uploads/2025/02/deluxeside.png HTTP/2
> Host: deluxeside.com
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/2 200 
< date: Sun, 09 Mar 2025 22:13:22 GMT
< content-type: image/png
< content-length: 4683
< cache-control: max-age=31536000
< cf-bgj: imgq:85,h2pri
< cf-polished: status=not_needed
< etag: "67af4fb7-124b"
< expires: Mon, 09 Mar 2026 22:13:20 GMT
< last-modified: Fri, 14 Feb 2025 14:14:15 GMT
< vary: Accept
< cf-cache-status: HIT

Whatever is going on looks to be due to a very specific portion of the accept header. It’s this: image/avif

Works:
curl -svo /dev/null 'https://deluxeside.com/wp-content/uploads/2025/02/vans-logo-png_seeklogo-257446-1-150x150.png' -H 'accept: image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8'

Doesn’t work:
curl -svo /dev/null 'https://deluxeside.com/wp-content/uploads/2025/02/vans-logo-png_seeklogo-257446-1-150x150.png' -H 'accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8'

Why that is, is a mystery. I can’t reproduce it on my APO site. What I do see is that it’s a .png file with a WebP filetype. I suspect you have something at the server that is optimizing your images, then causing Cloudflare to not cache them. But it’s not clear why that only happens with that avif accept header.

I suggest you experiment a bit at your server with some curl commands connecting directly to the server IP address, and look at the response headers for my example requests. Maybe even disable whatever it is that’s switching the filetypes, and using Polish instead:

3 Likes

You might be running into this issue here:

3 Likes

Wow! I did not know that! Thank you

I just disabled the “Vary: Accept” header on my server and also completely deactivated the polish because it takes long to create WebP images. Also, jpg&png images are served without cache while Cloudflare generates the WebP images.

I’m currently using a WordPress plugin to compress the images and convert them to WebP format. This is the Nginx rule I use (disabled “Vary: Accept” and AVIF format as you see):

Now, everything is working smoothly. Cloudflare caches both the JPG-PNG and WebP images separately :white_check_mark: :white_check_mark: :white_check_mark:

Thanks again! @Laudian @sdayman

2 Likes

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