Why is my website not being cached?

My website is not being cached and Cloudflare is always giving a BYPASS for me.
I’ve checked the responses from the origin server, but nothing indicates it should give a BYPASS.
Here are the related headers:

cache-control: public,max-age=31536000,immutable
cf-cache-status: BYPASS
last-modified: Wed, 18 May 2022 22:21:09 GMT

These are static assets like CSS, JS, HTML and they don’t change at all. When there is a new version, the application itself requests a new file with a new filename.

Redbot also says:

  • The resource last changed 8 hr 8 min ago.
  • This response allows all caches to store it.

I have a Cloudflare rule setup for:
circles.gallery/_app/ Cache Level: Cache Everything

Example of an asset is: https://circles.gallery/_app/pages/shop/index.svelte-1fe14f59.js

How can I debug this further? What else should I check?

please append an asterisk at the end, like this:

circles.gallery/_app/*
then this rule gets not solely applied to the matching directory, but additionall to all of its contained content aswell.

Please post the response header from the origin.
Please also post ALL of your PageRules from the overview.

Hello, sorry I mistyped my rule somehow, or it got deleted in the Markdown parsing maybe? I already have my rule setup as:

*circles.gallery/_app/*

I dont have any other rule applied from Cloudflare.
Also, as I mentioned, cache-control header sent from the origin is

cache-control: public,max-age=31536000,immutable

Here are all the headers returned:

HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Length: 244
Content-Type: application/javascript
Last-Modified: Thu, 19 May 2022 18:56:42 GMT
ETag: W/"244-1652986602000"
Cache-Control: public,max-age=31536000,immutable
Date: Sun, 22 May 2022 07:57:03 GMT
Connection: keep-alive
Keep-Alive: timeout=5

That seems to be the problem. Please remove the leading asterisk ‘*’ and replace it with the scheme, so your rule becomes:

https://circles.gallery/_app/*

Then clear cache and try again.

Hmm but wouldn’t this leave out https://www.circles.gallery/_app/*?

Actually yes, but please first try it, so we see it the pattern now is matching, then we can go from there on.

I was referring to this page: https://support.cloudflare.com/hc/en-us/articles/218411427-Understanding-and-configuring-Cloudflare-Page-Rules-Page-Rules-Tutorial-

It says below:

To match every page on a domain and it's subdomains, write *example.com/*. Just writing example.com won’t work.

I’ve just changed the rule to what you said. Do you know how long does it take to propagate through the system?

I know, but lately some rules did not match their expected pattern. Thats why I asked for. Should have happened immediately. You can change it back - did not work.

ATM I am clueless, don’t know all you other settings so hard to say anything precise.

I just tried adding Edge Cache TTL, Browser Cache TTL along side Cache Everything directive. If it should have been activated immediately, it did not work as well.

Hmm, are there any other related piece of setting that might affect this? I devoured all the documentation and community questions available, but my setup looks okay.

The origin server is behind render.com, not sure if they are not playing nicely somehow?

Possibly, it looks like render is using Cloudflare themselves, with their own IP addresses though

https://render.com/cdn-cgi/trace

But I have an “A record” pointing to my origin server IP. How could Render interfere with this traffic?
I’m not sure what I am saying is not very logical though.

Could you guide me to where can I send an email to Cloudflare Support for checking this out?

So my understanding is that because your host is using Cloudflare, only their settings will apply

1 Like

Wow interesting!!

However, it also says the following.

What Cloudflare currently does about it
Currently, any record pointing to a :orange: host is automatically set to :grey: and cannot be changed to :orange:. Going back to the example above, this means that because customer.host.com is set to :orange:, www.customer.com cannot be :orange: and is therefore set to :grey:. This means that certain Cloudflare services such as page rules and workers cannot currently be used in this situation.

My DNS setup indicates I am :orange:, anyways, I will ask this to Render’s support as well.

1 Like

If you use a CNAME to your onrender subdomain instead of an A record the IP, Cloudflare should send the traffic to your zone before going through Render’s.

Hmm I found a relevant discussion in Render’s community support page:

Will check using CNAME, thank you!

Hmm now I am using a CNAME to circlesgallerywebsite.onrender.com, with Cloudflare proxying enabled.
I can now see cf-cache-status: MISS header, rather than the BYPASS! I think this is a step towards the right direction?
Would using this configuration raise any other issues? Should I turn off the :orange: ?

1 Like

There shouldn’t be any issues with this configuration. There are a number of Render users currently doing this. It was the recommended setup from Cloudflare.

1 Like

Sorry the first request always is a MISS in cache, try to hardreload 2-3 more times. I ATM see HITs.

It was the recommended setup from Cloudflare.

I am very sure it was not like this a couple months ago when I setup the domain!

Thank you everyone! I am now seeing HITs starting to appear!
Will leave the docs here for others: Configuring Cloudflare DNS | Render

2 Likes