Caching CDN problem

I am using a wordpress theme, which comes along with a Mobile Theme also. I have set caching using WP Super Cache and I have set all caching settings according to the theme guide. By the way, I am using Cloudflare and I have also set Cloudflare settings according to the theme guide.

I also set Browser cache TTL to 1 month in cloudflare

Apart from that I have added the following 3 page rules in Cloudflare*
Security Level: High, Cache Level: Bypass, Disable Apps, Disable Performance*
Security Level: I’m Under Attack, Cache Level: Bypass, Disable Apps, Disable Performance*
Cache Level: Cache Everything, Origin Cache Control: On

I have also set cache control header in .htaccess . Below is the code

BEGIN Caching

Header set Cache-Control “max-age=2592000, public” Header set Cache-Control “max-age=604800, public” Header set Cache-Control “max-age=216000, private” Header set Cache-Control “max-age=216000, public, must-revalidate” Header set Cache-Control “max-age=1, private, must-revalidate” # END Caching

My response header for jpeg file are as below:

accept-ranges: bytes
cache-control: max-age=2592000, public
cache-control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0
cf-cache-status: BYPASS
cf-ray: 54988bd04b09c91c
content-length: 104228
content-type: image/jpeg
date: Mon, 23 Dec 2019 07:15:46 GMT
expect-ct: max-age=604800, report-uri=””
last-modified: Sun, 22 Dec 2019 07:58:16 GMT
server: cloudflare
status: 200
vary: Accept-Encoding

I have checked with my host and they have replied saying –

We checked the website and it’s currently using CloudFlare service for DNS and caching.
Also, the header reply for client’s site is also returned by CloudFlare server. What we can advise for this case is to correctly configure WordPress website for using CloudFlare for the headers to be correct.

I have checked with my theme developer, they have replied by saying

Please note that this has to be addressed directly to Cloudflare service.

Somehow Cloudflare’s CDN is not caching images and other files(cf-cache-status: BYPASS). Am I missing something here?

You have two conflicting cache-control headers. There should be only one cache-control header. The second one is disabling caching.

1 Like

Thank you for the reply. I have set only one cache-control header. Here is the screenshot of it in .htaccess ->

Scratching my head as to where the other is coming from?

It’s most likely either a plugin, or some obscure server configuration. You can narrow it down with curl -I (that’s a capital i):

curl -I --resolve

Use your origin server’s IP address.

1 Like

I tried that but couldn’t figure on where the second is coming from. I deactivated all my wordpress plugins, purged cache, it is still coming. I asked my host to check for server side configs. They have replied -

In order to fix this issue, you need to enable Flexible SSL on your Cloudflare settings. See these links for more info:

I have currently set Cloudflare SSL to Full . Will changing it to Flexible break my site?
Also, is this issue related to SSL?

Thank you for all help…

Problem solved. Thank you sdayman :smile:

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.