Whenever you use our CDN with perma-cache, you'll often see a few headers related to caching. We'll review each header and how the various combinations work.
CDN-Cache: This header shows the cache status on our CDN edge servers. Usually, you'd see HIT (Loaded from the CDN cache) or MISS (Loaded from perma-cache or origin).
Perma-Cache: This shows the status of the files in perma-cache. The status can be either HIT (Loaded from our storage) or MISS (Loaded from origin).
There are usually 4 combinations of the above two headers that you will see:
- cdn-cache: MISS / perma-cache: MISS
- cdn-cache: HIT / perma-cache: MISS
- cdn-cache: MISS / perma-cache: HIT
- cdn-cache: HIT / perma-cache: HIT
Let's go over each one and explain what they mean.
cdn-cache: MISS / perma-cache: MISS
If both headers show "MISS", it's because neither the CDN edge nor the perma-cache had the file in cache and we had to reach out to your origin to retrieve the content. Additionally, we will signal to the perma-cache system that the file should be fetched in the background.
cdn-cache: HIT / perma-cache: MISS
In this case, the file loads from the CDN edge server. But what about the perma-cache: MISS header? In a case like this, it means that when the CDN edge fetched the file, it was not yet in the perma-cache system.
Since the value of the perma-cache header will be cached as well, in a request where the cdn-cache header is a HIT, the perma-cache header should be ignored since it will not reflect the actual perma-cache status!
cdn-cache: MISS / perma-cache: HIT
The CDN edge server didn't have the file in the cache, so it fetched it from the closest perma-cache location available based on your storage replication settings.
This combination of headers will often show when the files are infrequently accessed.
cdn-cache: HIT / perma-cache: HIT
In this case, the file is cached on the CDN edge server and it was retrieved from the perma-cache system at the time of caching.