Permanent HIT on uncached pages

What is the name of the domain?

What is the issue you’re encountering

Permanent HIT on uncached pages

What steps have you taken to resolve the issue?

We have cache rules which cache content when a cookie value is present and to not cache content when a cookie is not present.

In general, it works. When a cookie is not present we get DYNAMIC, when a cookie is present we get HIT.
The problem is that we get HIT on all pages, even on first load. Also, we notice no page speed difference at all. When we test the cache here apart from Dev Tools where we see a HIT, we see that no cache is present: Cloudflare Cache Detector - Check if Cloudflare Cache Is Working.

We tried to figure out the issue, but so far we are clueless. It could be related to the combination of cache rules or the particular cache rule for the cookie. For the cookie value we use “contains” and not “equals”.

What are the steps to reproduce the issue?

  1. Enable cookie-based cache rule
  2. Login with user (Wordpress based)
  3. Empty all global cloudflare cache
  4. Load any page
  5. Any page will get a HIT at first load instead of a MISS

Also, worth note:

  • When user is logged in, WordPress sets correctly Cache-Control to private and “no cache”
  • The TTL setting of the cookie based cache rule is set to ignore Cache-Control-Header and to store cache 1 year (which works apparently at least by not showing DYNAMIC)
  • The Date of the cache is always shows current time
  • The expiry date of the cache is current time - 1 day (which should be at least somewhere around + 1 year when the global cache has been emptied before)

For any help or ideas we would be thankful.

Hello,

To further investigate, we would need an HAR File.
Could you kindly raise a ticket and attach the file? Please provide us the ticket number as well

Thank you

Hi @harshinik,

would love to, but raising a technical ticket requires a business account, which I don’t have. Any other support possible?

Thank you

Hey there!

Sorry to hear that your cache rule is not working as expected.

The problem is that we get HIT on all pages, even on first load.

Wouldn’t this be expected behavior? Your rule says to cache pages for cookie visitors.

  1. Any page will get a HIT at first load instead of a MISS

If someone else with a cookie visited between the time you purged and your visit, you would get a HIT. Please check the Age header of the HIT to see if it’s a somewhat recent copy.

raising a technical ticket requires a business account,

Go ahead and open it as an Account issue, then share the ticket # here, and we can take a look at it.

Hi @cf-scott ,

thanks for the hint. I just submitted the ticket with the HAR file

01010828

Wouldn’t this be expected behavior? Your rule says to cache pages for cookie visitors.

The behavior when Cloudflare Cache is empty is on first visit MISS (as the page is not present in Cloudflare Cache) and on second visit HIT (as the page is now cached and present in Cloudflare Cache). Currently it shows on any page HIT which indicates a problem. Also we don’t see any speed gains, which would be normal result of a cached page.

If someone else with a cookie visited between the time you purged and your visit, you would get a HIT. Please check the Age header of the HIT to see if it’s a somewhat recent copy.

We are conducting the tests on staging environment where no normal user is present. Our tests are conducted immediately after the global cache is cleared. So we can reproduce this problem on any page. No user with cookie has visited the page before in that moment.

Hope we can find the rootcause of the behaviour here.

Thanks

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