How do I use CURL to check the status of a CDN resource?
In your linux command prompt, type the following command:
curl -I mycdnurl.com
[cs.yap@onappvpn ~]$ curl -i -vvv -o /dev/null -s
HTTP/1.1 200 OK
Date: Mon, 09 Dec 2013 09:24:15 GMT
Last-Modified: Mon, 18 Mar 2013 20:11:40 GMT
Cache-Control: max-age=2592000, public
Expires: Tue, 07 Jan 2014 12:42:29 GMT
X-Edge-Location: Amsterdam, NL
(1) The curl is run on CDN resource "cdn.onapp.com" (cdn hostname) , with the url path "/files/datasheets/onapp_cdn_datasheet_0313.pdf"
(2) The HTTP request is successful because it returns "200" status code. If the request returns a 300 level status code, then the resource will not cache, and whatever redirect is causing the 300 must be removed in order for the resource to cache. If the resource returns a 400 or 500, these are typically inherited from the origin and you should check the origin and resolve the issue there.
(3) "Cache-Control: max-age=2592000, public" , the file "onapp_cdn_datasheet_0313.pdf" will be cached in this CDN edge server for 2592000 seconds. If the result shows "Cache-Control: No Cache" or "Cache-Control: Private" , then the files would not be cached.
(4) "X-Age: 74506", the file "onapp_cdn_datasheet_0313.pdf" is already cached in this edge server for 74506 seconds.
(5) "X-Edge-IP: 18.104.22.168" , this http request get redirected to 22.214.171.124 (CDN edge server IP)
(6) "X-Edge-Location: Amsterdam, NL" , this http request get redirected to Amsterdam CDN PoP
(7) "X-Cache: HIT" , the file "onapp_cdn_datasheet_0313.pdf" is already exist in this edge server, so this edge server will not fetch the file from the origin. If it shows "X-Cache: MISS", that means file "onapp_cdn_datasheet_0313.pdf" was not cached in this edge server before this.