Debugging HIT & MISS strange requests

Hello, we’ve been experiencing some strange situations with some of our app’s requests. To give you a little bit of background, we are running a web-distributed app that is integrated with Cloudflare mainly for assets caching. We have certain resources (specifically JSON files with cache: everything rules) that we are versioning and using Cloudflare to serve the cached content for as long as possible, to avoid straining our servers with requests, as there are quite a lot of them.

However, for certain domains, we’ve been seeing unusually large numbers of uncached requests and I can’t really pinpoint the exact cause why in some situations, CF responds with a MISS for resources that should actually be cached.

I will post some examples below & explain what I’ve found so far:

Request #1 - correctly cached, going through my regular connection:

access-control-allow-origin: *
age: 2846
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
cache-control: max-age=604800, public, s-maxage=604800
cf-cache-status: HIT
cf-ray: 6a11e017eac068b9-BUD
content-encoding: br
content-type: application/ld+json
date: Wed, 20 Oct 2021 11:23:40 GMT
etag: W/"94c896bf9345a0eacca49b0eb56a6b19"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Wed, 27 Oct 2021 10:36:14 GMT
last-modified: Wed, 20 Oct 2021 10:36:14 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=qgtVON4MrA2vbRVYGRcKUdhQgmPoHzGuvfPdhVSa%2FUsoq%2B4MX79TrfoWr36dOP7BmHJMKbzpGPh0wOKpso6nuRjeNBOObUhE5djKfbPiKIYmfrOfpVyYPsm9nFUr"}],"group":"cf-nel","max_age":604800}
server: cloudflare
vary: Origin
vary: Accept

Request #2 - using Opera VPN set to US, request is MISS-ed, but it should be cached

access-control-allow-origin: *
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
cache-control: max-age=604800, public, s-maxage=604800
cf-cache-status: MISS
cf-ray: 6a11dbe05dfac17a-IAD
content-encoding: br
content-type: application/ld+json
date: Wed, 20 Oct 2021 11:20:47 GMT
etag: W/"bd70ba05417e68d9c937707d39e2e7b3"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Wed, 27 Oct 2021 11:20:47 GMT
last-modified: Wed, 20 Oct 2021 11:20:47 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=gz1oh5DsfOwOoV8fZnEHset9oGml2cafK2xQq7CWwTW1D%2FR8%2BQ5piBONB5xEwiqeelhjnlXf7oHdEe8sYW4WrMqFgoZdVzVq6wk8irEqv%2BBaOvnkPpU1Z6bO1oy6L2UZ3YqaFw%2Fk9isC"}],"group":"cf-nel","max_age":604800}
server: cloudflare
vary: Origin
vary: Accept

Request #3 - still using Opera VPN, after having refreshed a couple of times:

access-control-allow-origin: *
age: 1950
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
cache-control: max-age=604800, public, s-maxage=604800
cf-cache-status: HIT
cf-ray: 6a11ddee1d825ba7-IAD
content-encoding: br
content-type: application/ld+json
date: Wed, 20 Oct 2021 11:22:11 GMT
etag: W/"857681fff6bdeec260669e169e10fceb"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Wed, 27 Oct 2021 10:49:41 GMT
last-modified: Wed, 20 Oct 2021 10:49:41 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=f%2BuIMC4DMbAxaZkX6m9NnK3e4DlJC20sEguMubTkGXpbKyL9JTIECL4IaSPiWRJBrxPsaUGBKNqBY0ob5i9Wq6q0u9xm60YTZHbIkZCub4zKaQyk%2Fs%2BbVH0lPkYIEHWzOF6UCMVpNbV%2B"}],"group":"cf-nel","max_age":604800}
server: cloudflare
vary: Origin
vary: Accept

Now, the problem is that for the exact same connection, going through what seems to be the same region, we are receiving mixed MISS & HIT responses. What’s also strange, is that when we get HITs, the age is different for different requests, but I assumed this is because there are different data centers handling those requests and not having the same lifetime all over the nodes, which should be generally fine.

Could you please help us understand what could be causing this behavior or what methods do we have to further debug this and pinpoint the issue? Is not a resource considered cached by CF regardless of the region/DC that first cached it?

Thank you.

You are simply hitting different datacenters here. In one case, you are going via the Hungarian datacenter in Budapest, in the other via the US datacenter in Washington.

Remember, caching is datacenter-based and resources will only be fully cached after that particular datacenter received a couple of requests and even then there is no guarantee for how long Cloudflare will cache the resource.

1 Like

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