Varnish: Purge says it works but doesn't remove old content
Asked Answered
C

1

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

Crin answered 4/9, 2015 at 6:55 Comment(9)
Are you purging the complete url? with parameters and everything?Maskanonge
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.Crin
Weird, have you tried ban instead of purge? I don't know, it may work (by ban I mean this )Maskanonge
Did you try using curl in stead of a browser to test this? Could be that your browser is caching the url.Moia
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.Terranceterrane
Did anyone solve this? I'm experiencing the same thingCub
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.Friedrick
I am getting the exact same issue. Age does not decrease, HITS keep increasing. Has anyone found a solution to this ?Demented
Same here, but in my case HITS gets increased and then after a few requests they reset to 1 instead of MISSSnowbound
C
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.

Cotemporary answered 29/4, 2020 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.