http purge help

Charlie Farinella cfarinella at appropriatesolutions.com
Mon Feb 18 23:20:32 CET 2008


I am new to Varnish, am trying to implement HTTP purging, and
getting 'not found' responses.  If anyone has a moment to look over
our configuration and make some suggestions or point out errors,
we would be grateful, we are at our wits end.

We have Varnish running behind lighttpd on port 6081 proxying
a Plone installation, so we have lighttpd at port 80, Varnish
at port 6081, and Zope/Plone at port 8080.  All are working as
expected.

uname -n = nec.appropriatesolutions.com

We have our vcl.conf configured like this:
###
acl purge {
                "localhost";
                "127.0.0.1";
}

sub vcl_fetch {
        # force minimum ttl of 300 seconds
        if (obj.ttl < 300s) {
                set obj.ttl = 300s;
        }
}

sub vcl_hit {
        if (req.request == "PURGE") {
                set obj.ttl = 0s;
                error 200 "Purged";
        }
}

sub vcl_miss {
        if (req.request == "PURGE") {
                error 404 "What you have requested is not in cache";
        }
}
###

We are attempting to send the purge request with a Python script, like 
so:
###
#!/usr/local/bin/python
from httplib import HTTP, HTTPConnection, HTTPResponse

h = HTTPConnection('127.0.0.1:6081')
h.request('PURGE', '/', '', {'Host': 'www.nec.edu'})
resp = h.getresponse()
print resp.read()

status = resp.status
reason = resp.reason
headers = resp.getheaders()

print 'status: ', status
print 'reason: ', reason
print

print headers
print
###

Our varnish log is showing:
###
127.0.0.1 - - [18/Feb/2008:16:14:12 -0500] "PURGE http://www.nec.edu/ 
HTTP/1.1" 404 451 "-" "-"

and the output of the script is:
###
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>404 Not Found</title>
  </head>
  <body>
    <h1>Error 404 Not Found</h1>
    <p>What you have requested is not in cache</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 891821294</p>
    <address><a 
href="http://www.varnish-cache.org/">Varnish</a></address>
  </body>
</html>

status:  404
reason:  Not Found

[('content-length', '451'), ('x-varnish', '891821294'), ('age', 'nan'), 
('server', 'Varnish'), ('retry-after', '0')
('connection', 'keep-alive'), ('via', '1.1 varnish'), 
('date', 'Mon, 18 Feb 2008 22:08:49 GMT'), ('content-type', 'text/html; 
charset=utf-8')]

-- 
------------------------------------------------------------------------
Charles Farinella 
Appropriate Solutions, Inc. (www.AppropriateSolutions.com)
cfarinella at AppropriateSolutions.com
voice: 603.924.6079   fax: 603.924.8668




More information about the varnish-misc mailing list