We moved this page to our Documentation Portal. You can find the latest updates here. |
Question:
How can I check if a file is cached?
Answer:
You can check if your file is cached with curl:
curl -I [url]
For example:
[cs.yap@onappvpn ~]$ curl -I http://images.z22se.org.uk/Z22SE_logoUIX.png
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 24 Oct 2013 08:05:39 GMT
Content-Type: image/png
Content-Length: 9049
Connection: keep-alive
Vary: Accept-Encoding
Last-Modified: Tue, 20 Aug 2013 09:41:50 GMT
X-Age: 512353
X-Edge-IP: 173.244.216.19
X-Edge-Location: Washington, US
X-Cache: HIT
Accept-Ranges: bytes
That means http://images.z22se.org.uk/Z22SE_logoUIX.png is cached in the Washington Edge, because X-Cache: HIT. If the result is X-Cache: MISS , means the file were not cached in the CDN PoP. Curl another time, you should see X-Cache: HIT, however if you see X-Cache: MISS again, that means the file will not be cached in the CDN PoP at all, in that case, you will need to check the setting of the cache control header.
Use the same command again, for example:
[cs.yap@onappvpn ~]$ curl -I http://data.z22se.org.uk/Z22SE_logoUIX.png
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 24 Oct 2013 08:26:48 GMT
Content-Type: image/png
Content-Length: 9049
Connection: keep-alive
Last-Modified: Tue, 20 Aug 2013 09:41:50 GMT
Expires: Fri, 22 Nov 2013 16:44:54 GMT
Cache-Control: max-age=2592000
Cache-Control: public, must-revalidate, proxy-revalidate
X-Age: 56514
X-Edge-IP: 173.244.216.19
X-Edge-Location: Washington, US
X-Cache: HIT
Accept-Ranges: bytes
This means the file will be cached for 2592000 seconds because Cache-Control: max-age=2592000. If Cache-Control: max-age= No Cache, the file will never be cached in our CDN PoP.