leohxj
leohxj

Reputation: 1047

How to judge a request from CDN?

In the Network panel of Chrome devtools, I can see the header of a request. If a request come from CDN, is there a flag in header, such as x-cache: hit?

But sometime the request doesn't has the x-cache flag.So how can I judge it?

Upvotes: 0

Views: 946

Answers (1)

CodyA
CodyA

Reputation: 429

Yes, if you are using a CDN to pull content from your origin server, most often times the HTTP header X-Cache is displayed in the response. Although this header can also differ depending upon which CDN you are using (e.g. Cloudflare uses: CF-Cache-Status).

This header however won't be displayed if you are using a CDN push zone to host your files directly on the CDN's servers. However, to verify that the asset is being delivered from the CDN, you should still see a response header such as Server: YourCDN.

For reference, these images show the difference between a push / pull zone.

Upvotes: 2

Related Questions