LOG IN SIGN UP
Documentation

Curl and other caching verification methods

The easiest way to tell if your request is caching in the Fastly network is via the command line. The following command will display the request and response headers for a given object:

curl -svo /dev/null www.example.com/index.html

where www.example.com/index.html is replaced with the full object path of the object you're testing.

Examine the output looking for the X-Cache header. A properly caching object will display a value of X-Cache: HIT or X-Cache: HIT, HIT. For example, using curl -svo /dev/null www.fastly.com would produce something like the following:

* Rebuilt URL to: www.fastly.com/
* Hostname was NOT found in DNS cache
*   Trying 199.27.79.184...
* Connected to www.fastly.com (199.27.79.184) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: www.fastly.com
> Accept: */*
>
< HTTP/1.1 200 OK
* Server Apache is not blacklisted
< Server: Apache
< Last-Modified: Thu, 29 Jan 2015 22:53:28 GMT
< Timing-Allow-Origin: *
< Cache-Control: max-age=0
< Content-Type: text/html; charset=utf-8
< Via: 1.1 varnish
< Content-Length: 17493
< Accept-Ranges: bytes
< Date: Mon, 02 Feb 2015 22:55:01 GMT
< Via: 1.1 varnish
< Age: 85133
< Connection: keep-alive
< X-Served-By: cache-iad2120-IAD, cache-lax1433-LAX
< X-Cache: HIT, HIT
< X-Cache-Hits: 1, 920
< X-Timer: S1422917701.508078,VS0,VE0
< Vary: Accept-Encoding
<
{ [data not shown]
* Connection #0 to host www.fastly.com left intact

Translations available [JA] 日本語