9

One of the Wordpress blogs I'm giving maintenance is not purging the cache using the plugin Varnish HTTP Purge. Whether using Varnish Cache Purge button or when we edit a post.

In order to know the cause of the problem, I would like to know a way to check if the purge request is reaching the Varnish server, maybe using varnishlog command.

http://wordpress.org/plugins/varnish-http-purge/

3 Answers3

21

Varnish 4.0

varnishlog -g request -q 'ReqMethod eq "PURGE"'
kervin
  • 11,672
  • 5
  • 42
  • 59
6

Varnish 3.x

varnishlog -d -c -m RxRequest:PURGE

That will output any of the purges in memory. And without -d it will output only current requests:

varnishlog -c -m RxRequest:PURGE

From man varnishlog:

-d Process old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts.

vard
  • 4,057
  • 2
  • 26
  • 46
0

It could be as simple as the varnish config limiting purge requests to a certain IP, or set of IPs. I know that my typical varnish configs include:

acl purge {
  "127.0.0.1";
  "123.45.67.0"/24;
}

sub vcl_recv {
  ....

  if (req.request == "PURGE") {
    if (!client.ip ~ purge) {
      error 405 "Not allowed.";
    }   
    return (lookup);
  }

  ....
}   

I would check that first, especially the config was copied off some examples off the varnish website. Almost all of them include an ACL for purge.

loushou
  • 1,462
  • 9
  • 15