Akamai Pragma Header

Adding the Pragma header in http request is very helpful when troubleshooting Akamai caching. The Pragma header can be:”akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no”

In the http response, the following value can tell us whether the URL is cached by Akamai, and how long it is cached.

X-Check-Cacheable: It shows whether the content is cached on Akamai ‘YES/NO’

X-Cache/ X-Cache_Remote: It shows the cache status

TCP_HIT: The object was fresh in cache and object from disk cache.
TCP_MISS: The object was not in cache, server fetched object from origin.
TCP_REFRESH_HIT: The object was stale in cache and we successfully refreshed with the origin on an If-Modified-Since request.
TCP_REFRESH_MISS: Object was stale in cache and refresh obtained a new object from origin in response to our IF-Modified-Since request.
TCP_REFRESH_FAIL_HIT: Object was stale in cache and we failed on refresh (couldn’t reach origin) so we served the stale object.
TCP_IMS_HIT: IF-Modified-Since request from client and object was fresh in cache and served.
TCP_NEGATIVE_HIT: Object previously returned a “not found” (or any other negatively cacheable response) and that cached response was a hit for this new request.
TCP_MEM_HIT: Object was on disk and in the memory cache. Server served it without hitting the disk.
TCP_DENIED: Denied access to the client for whatever reason
TCP_COOKIE_DENY: Denied access on cookie authentication (if centralized or decentralized authorization feature is being used in configuration)

X-Cache-Key: It is the cache key referred by Akamai. The caching length can be found here.

0s: 0 second cache meaning serve from cache but revalidate on every request, e.g. check origin but don’t re-download unless changed
000: Non-cacheable…a key code to recognise
1s: 1 second
1m: 1 minute
1h: 1 hour
1d: 1 day

For example, the following test tells me that http://www.sony.com is cached on Akamai for 5 minutes

curl -v -H “Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key” http://www.sony.com -o /dev/null

* Rebuilt URL to: http://www.sony.com/
* Hostname was NOT found in DNS cache
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 –:–:– –:–:– –:–:–     0*   Trying…
* Connected to http://www.sony.com ( port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.0
> Host: http://www.sony.com
> Accept: */*
> Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key
< HTTP/1.1 200 OK
* Server Apache is not blacklisted
< Server: Apache
< ETag: “cc962ed505a54c8ec01bb8cfe81dad35:1431277376”
< Last-Modified: Sun, 10 May 2015 16:37:01 GMT
< Content-Type: text/html
< Cache-Control: max-age=300
< Date: Mon, 11 May 2015 02:35:05 GMT
< Transfer-Encoding:  chunked
< X-Cache: TCP_MEM_HIT from a104-72-70-102.deploy.akamaitechnologies.com (AkamaiGHost/7.2.0-15182023) (-)
< X-Cache-Key: /L/9131/354500/5m/sgweu.download.akamai.com/200316/FolderC/production/
< Connection: keep-alive
< Connection: Transfer-Encoding
< Set-Cookie: geofilter_country=AU; expires=Tue, 10-May-2016 02:35:05 GMT
< X-Check-Cacheable: YES
{ [data not shown]
100  192k    0  192k    0     0   908k      0 –:–:– –:–:– –:–:–  905k
* Connection #0 to host http://www.sony.com left intact


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s