CDN Cache Troubleshooting Guide - andywahr/azure-cdn-guidance GitHub Wiki

When setting up a CDN, for Static Content like CSS and JS or for Dynamic Content thru DSA, there is always the need to verify your caching rules. Each of the three Providers (Microsoft, Verizon, Azure), have a different way you can get the basic information of was it serving from cache or the origin.

First thing to check is your cache headers

They all involve reading special Response Headers and generally looking for TCP_HIT as one of their values. Verizon and Akamai have a lot of detailed headers you can request, but require you to decorate your requests for a special Request Header. Detail is below.

Microsoft

Microsoft Troubleshooting Guide on Azure

It's automatic, each Response comes with a X-Cache header, look for TCP_HIT or TCP_REMOTE_HIT for a cache success. TCP_HIT means it was returned by the POP (Point of Presence) and the TCP_REMOTE_HIT is returned from the "Origin Shield" cache. Think of this as the first level of caching from your site. This way subsequent requests for that resource from a POP that hasn't seen request doesn't have to request it from Origin.

Verizon

Verizon Troubleshooting Guide on Azure

To get info, you need to send the X-EC-Debug header with your request and you will get an X-EC-Debug response header with detail. There are several directives you can send, for example:

X-EC-Debug: x-ec-cache,x-ec-check-cacheable,x-ec-cache-key,x-ec-cache-state

For a simple HIT or MISS

X-EC-Debug: x-ec-cache

You will get a response of:

X-EC-Debug: x-ec-cache: TCP_HIT from ECD (lga/0FE8)

Akamai

Akamai Troubleshooting Guide

To get info, you need to send the Pragma header with your request and you will get an X-Cache and possibly others based on directives (X-Check-Cacheable, X-Cache-Remote, and lots of X-Akamai-*) response header with detail. There are several directives you can send, for example:

Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-get-request-id

For a simple HIT or MISS

Pragma: akamai-x-cache-on

You will get a response of:

X-Cache: TCP_MEM_HIT from a165-254-246-9.deploy.akamaitechnologies.com