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 ...

Get Troubleshooting CentOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.