1

I have varnish 3.0.5 up and running, connecting to a Plone 4 backend. My requests are cached, but not purged reliably, actually only after expiration of the ttl. plone.app.caching is the addon, which sends a purge request, every time an object is modified. This is the varnishlog:

   14 BackendOpen  b backend_0 127.0.0.1 54428 127.0.0.1 9088
   14 BackendXID   b 1585950387
   14 TxRequest    b PURGE
   14 TxURL        b /VirtualHostBase/https/example.com/path/VirtualHostRoot/pic/a.jpg
   14 TxProtocol   b HTTP/1.1
   14 TxHeader     b Host: localhost:9081
   14 TxHeader     b X-Varnish: 1585950387
   14 BackendClose b backend_0
   13 ReqStart     c 127.0.0.1 56614 1585950387
   13 RxRequest    c PURGE
   13 RxURL        c /VirtualHostBase/https/example.com/path/VirtualHostRoot/pic/a.jpg
   13 RxProtocol   c HTTP/1.1
   13 RxHeader     c Host: localhost:9081
   13 VCL_call     c recv pipe
   13 VCL_call     c hash
   13 Hash         c /VirtualHostBase/https/example.com/path/VirtualHostRoot/pic/a.jpg
   13 VCL_return   c hash
   13 VCL_call     c pipe pipe
   13 Backend      c 14 backend_0 backend_0
   13 ReqEnd       c 1585950387 1412603444.714001656 1412603505.824758053 0.000071526 0.000180483 61.110575914

Within default.vcl I have configured acl purgers, basic vcl_hit and vcl_miss functions, and inside of vcl_recv I have:

if (req.request == "PURGE") {
    if (!client.ip ~ purge) {
        error 405 "This IP is not allowed to send purge requests.";
    }
    return (lookup);
}

When I open the image after purging, I still get the old version, until max age has expired. This is the shortened log output:

3 RxURL        c /VirtualHostBase/https/example.com:443/path/VirtualHostRoot/pic/a.jpg
3 RxProtocol   c HTTP/1.0
3 RxHeader     c Host: enertour.bz.it
3 VCL_call     c recv lookup
3 VCL_call     c hash
3 Hash         c /VirtualHostBase/https/example.com/path/VirtualHostRoot/pic/a.jpg
3 VCL_return   c hash
3 Hit          c 1585950403
3 VCL_call     c hit deliver
3 VCL_call     c deliver deliver
3 TxHeader     c Cache-Control: max-age=0, s-maxage=240, must-revalidate
3 TxHeader     c X-Cache-Rule: plone.content.file
3 TxHeader     c Age: 181

What I've done until now is rewriting the hash value of the request, to match the hash of the purge request. They are identical, but my object is not purged and I can't figure out why? Is it because the requesting host changes?

Glad about any hints!

3
  • Could you please post your complete VCL.
    – Ketola
    Oct 7, 2014 at 5:40
  • Damn, I'm such a stupid! Looking again at my vcl today I figured out that during modifications the purge function slipped under the lines where I check the request types. Therefore a purge wasn't allowed and it finished in a pipe. Sorry for claiming your time!
    – boernie
    Oct 7, 2014 at 8:17
  • boernie: post this as an answer, and then set it as the 'correct' answer, so it shows up as answered, and others coming across can learn from your experience.
    – Kirrus
    Nov 7, 2014 at 16:06

1 Answer 1

0

Looking again at my vcl today I figured out that during modifications the purge function slipped under the lines where I check the request types. Therefore a purge wasn't allowed and it finished in a pipe. The correct order is:

if (req.request == PURGE) {
  ...
  return (lookup);
}
if (req.request != "(GET|HEAD)" {
  ...
  return (pass);
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .