Testing Varnish with cURL
If the web server relies on Varnish, then it is particularly important to ensure that your web pages are being cached and that they are served in a timely manner.
To confirm this, you can begin with the following syntax:
# curl -I http://www.example.com/index.html
Having used the -I
option to display the headers only, if Varnish is installed, you should see something like this:
HTTP/1.1 200 OK Date: Fri, 06 Mar 2015 00:59:24 GMT Server: Apache/2.4.6 (CentOS) PHP/5.5.22 X-Powered-By: PHP/5.5.22 Content-Type: text/html; charset=UTF-8 X-Varnish: 5 3 Age: 16 Via: 1.1 varnish-v4 Content-Length: 97422 Connection: keep-alive
In the preceding example, the most important lines are the following:
X-Varnish: 5 3 Age: 16
Now, let's run through a quick explanation of these values:
X-Varnish: XXXXXXXX XXXXXXXX
: TheX-Varnish
header not only contains an ID of the current request, but also maintains the ID of the request that populated the cache. If there is only one number, you...