I found that files requested across domains could not be cached

#1

I found that files requested across domains could not be cached. For example, I use Microsoft’s edge browser to access the pages of my website. There are some cross-domain resources in the pages, but this browser loads these resources without Origin header. Then I opened Google’s Chrome and found that Chrome had Origin headers when accessing these cross-domain resources through its pages.And although these resources have been accessed once in edge browser, when accessed in Chrome, the cache state is still miss, not hit.

The same file with different “Origin” will be cached many times
#2

Only the domain which you configured on Cloudflare will go through Cloudflare and have its resources cached. Other domains wont.

#3

Yes, these cross-domain files and their corresponding domain names already use cloudflare’s CDN. My problem is that there are two different browsers when they request across domains. There is no Origin in the Edge request headers, but Chrome has Origin.This difference results in the fact that files cached by edge browsers are still missed when Chrome accesses them.

#4

Caching is not browser but solely datacentre related. Assuming both browsers go through the same datacentre (which they should) data already request should be cached (unless you have directives which prevent that).

#5

Thank you very much. Maybe there is something wrong with my settings. I did test it many times. The same URL file. With or without origin, cloudflare would think of two files that need to be cached twice.

#6

CloudFlare will sometimes behave differently for different browsers. Such as serving webp images to only those that support it. I think what we’re seeing is that type of smart serving/caching.

1 Like
#7

^

If possible, post some example files we can test. also see https://cf-cache-status.net/ if you want to check yourself, and https://cloudflare-test.judge.sh/ to check if both sites go to the same datacenter.

#8

Testing requires tools such as “HttpAnalyzer”. Change the value of “Origin” in the request headers to access a file that allows caching. The value of “cf-cache-status” is always “MISS”.This means that the same file with different “Origin” will be cached many times.

#9

Change the value of “Origin” in the request headers to access a file that allows caching. The value of “cf-cache-status” is always “MISS”.This means that the same file with different “Origin” will be cached many times.How can I let cloudflare ignore the “Origin” change and cache it only once?