No Caching on Cloudflare


#1

I have my site hosted on Amazon Web services and serving static content from S3 proxied from Cloudflare. Even, I have set page rules to cache everything from my domain (cdn.techlazy.com)/

Even, then cloudflare is not caching that asset even after the response from origin looks like this
Cache-Control:max-age=31536000
Date:Fri, 20 Oct 2017 18:11:11 GMT
ETag:“1e5c4844c7cb7b4aed157f62e0873df2”
Expires:Tue, 16 Oct 2018 14:18:58 GMT
Last-Modified:Mon, 16 Oct 2017 14:19:00 GMT
Server:AmazonS3
x-amz-id-2:CQDoWTH8/TZdTnKbKdf9sksm9ycdBaSlbgCFJhVKg7Z82o/pCfim0ZYTmYOuLa6xAacGlW6ZWik=
x-amz-request-id:489E0775A7E03D2C


#2

Are you testing using https? Because the page rule you have for cache everything is https. And tests against the host provided above show a cache status of hit when I test.

As for the content itself (e.g. wp-content/uploads/2014/08/16194858/secrate-10-tips-for-setting-up-new-computer-125x125.jpg) ylu also have an explicit rule to bypass the cache for it so it won’t be cached.


#3

I am not getting any cache status header in the Response. Also, how can you say that the content is having explicit rule to bypass cache? (as cache-control:max-age=31536000)


#4

The regex in your first page rule matches http(s)://cdn.techlazy.com/wp-content/uploads/2014/08/16194858/secrate-10-tips-for-setting-up-new-computer-125x125.jpg and it is set to bypass cache.

We don’t send a cache status on items which aren’t cached by Cloudflare and your page rule is instructing us not to cache as the object is considered not cacheable.


#5

Thank you so much @cscharff
It is working now.

And Apologies for this silly mistake.


#6

lol… no worries at all. My own page rules cause me no end of headache and I can’t tell you how many times someone has looked over my shoulder and pointed out I have one configured incorrectly. :smiley: