Check if a page is cached

wget -S -O /dev/null


  HTTP/1.1 200 OK
  Content-Type: text/html; charset=utf-8
  Content-Length: 264867
  X-Varnish: 1776170404 1776161586
  Via: 1.1 varnish
  Connection: keep-alive
  Cache-Control: 300
  Expires: 300
  Age: 300
  X-Varnish-Cache: HIT

The X-Varnish allow to cross-reference the request and cache objects. The way I see it, the second ID is the cached object id. If you are flushing the cache, the second ID should change, otherwise stays the same if you are hitting the same cache.

Test the Varnish conf

varnishd -C -f default.vcl | less

Restart Varnish / reload conf

service varnishd restart

NB: this flushes the cache. There are other ways to do this, but it depends on the setup.

Varnish stats


FreeBSD configurations

See: /etc/rc.conf