how to purge via http

David Birdsong david.birdsong at
Sat Jan 16 04:46:31 CET 2010

I curl and the hit count is 3

curl -I http://localhost:6081/lru.10.cache.buster
HTTP/1.1 200 OK
Server: nginx/0.7.64
Content-Type: application/octet-stream
Last-Modified: Sat, 16 Jan 2010 03:03:10 GMT
X-Varnish-Port: 6081
Content-Length: 104857600
Date: Sat, 16 Jan 2010 03:35:58 GMT
X-Varnish: 1453995344 1453994021
Via: 1.1 varnish
Connection: keep-alive
X-Varnish-Hits: 3
age: 0

I try to purge using nc:
nc localhost 6081  < /tmp/purge_reqest

contents of purge_reqest:
PURGE /lru.10.cache.buster HTTP/1.0

I get a 404.   I curl again and the hit-count is incremented to 4.  I
even put the url in the error to see how varnish sees my handwritten
http request:
sub vcl_miss {
  if (req.request == "PURGE") {
    error 404 req.url;

and the url looks valid:

$ nc localhost 6081  < /tmp/purge_reqest
HTTP/1.1 404 /lru.10.cache.buster
Server: Varnish
Retry-After: 0
Content-Type: text/html; charset=utf-8
Content-Length: 491
Date: Sat, 16 Jan 2010 03:41:45 GMT
X-Varnish: 1453995582
Via: 1.1 varnish
Connection: close
X-Varnish-Hits: 0
age: 0

I checked to see that curl isn't manging up the url:

# nc -l 6083
HEAD /lru.10.cache.buster HTTP/1.1
User-Agent: curl/7.18.2 (x86_64-redhat-linux-gnu) libcurl/7.18.2
NSS/ zlib/1.2.3 libidn/0.6.14 libssh2/0.18
Host: localhost:6083
Accept: */*

that looks ok.

What am I doing wrong, why is the url not found in the cache between
the different requests?

More information about the varnish-misc mailing list