6

I'm running a stand alone instance of varnish on a Digital Ocean Ubuntu VM which basically works fine. The setup is used to take load of an older wordpress server that sits anyhwere else. That works quite well but i'm having a hard time getting content purged. And when talking about purge i mean to invalidate the cache for a URL to force varnish to fetch a fresh version from the backend (just to make sure as i've seen some irritation about purge/ban).

I have setup an ACL for purge and as far as i can see with varnishlog the purges get accepted - on one side from the WordPress blog (where W3TC handles the purges) as well es from the local console where i tried to purge with curl -X PURGE http://url.to.purge

The problem is that i still get the old versions of the URL in the browser on matter what i do locally.

This is how i handle purge in vcl_recv:

  if (req.method == "PURGE") {
    if (!client.ip ~ purge) {
      return(synth(405,"Not allowed."));
    }
    return (purge);
  }

and i get VCL_error(200, Purged) on every purge so i guess it's probably ok.

Looks like i'm still doing things wrong. After giving service varnish a restart the full cache refreshes and the pages refresh too - until then varnish keeps everything for ages - no matter how much i'm purging.

my Varnish version is 4.0.3.

Any idea?

Thanks,

Frank

Helmi
  • 489
  • 7
  • 25
  • Are you purging the complete url? with parameters and everything? – Redithion Sep 04 '15 at 15:20
  • there's no parameters and yes i do purge the exact URL. Also it doesn't matter which URL - even the homepage doesn't work. The entry in varnishlog does look good but in fact the content doesn't get purged. – Helmi Sep 04 '15 at 17:59
  • Weird, have you tried `ban` instead of purge? I don't know, it may work (by ban I mean [this](https://www.varnish-cache.org/docs/trunk/users-guide/purging.html#bans) ) – Redithion Sep 04 '15 at 19:33
  • Did you try using curl in stead of a browser to test this? Could be that your browser is caching the url. – brujoand Sep 19 '15 at 13:46
  • Did you ever figure this out? We are having the exact same thing. varnishlog and the headers returned by curl all make you think it was okay.. But the age on the file does not reset. – byoungb Apr 07 '17 at 20:18
  • 1
    Did anyone solve this? I'm experiencing the same thing – alekstrust Sep 02 '18 at 03:17
  • Having the same isssue on Varnish 4.0.5. I see the ban in the ban.list, when the page gets hit it removes the ban but the age on the page remains the same. – drew7721 Jan 03 '19 at 21:42
  • I am getting the exact same issue. Age does not decrease, HITS keep increasing. Has anyone found a solution to this ? – Liviu Mar 25 '19 at 11:19
  • Same here, but in my case HITS gets increased and then after a few requests they reset to 1 instead of MISS – hp10 Sep 30 '19 at 09:27

1 Answers1

0

Got same behavior on Varnish 6 with vcl 4.1. The only way to solve it was explicitly define sub vcl_purge like this:

sub vcl_purge {
set req.method = "GET";
set req.http.X-Purger = "Purged";
return (restart);
}

Didn't find the reason and this may not be exactly what you want because after purge it will get content from the backend without waiting for client request. But still didn't find another way and this is good enough for me.