Not seeing a successful purge

Laurence Rowe l at lrowe.co.uk
Fri Feb 12 11:49:13 CET 2010


Hi,

Your PURGE request is getting a different hash than your browser
requests because there is no Accept-Encoding header on the PURGE. (You
see the same problem when using Vary on the response). See
http://varnish-cache.org/wiki/Purging. You can either use <<
purge("req.url ~ " req.url); >> in vcl_recv, or send multiple PURGE
requests with each of the relavant Accept-Encoding values.

Laurence

On 11 February 2010 23:25, John Norman <john at 7fff.com> wrote:
> Hi, folks.
>
> I'm trying to purge with the pseudo HTTP "PURGE" method Varnish supports.
>
> I do seem to have a cached page, but the PURGE response suggests that
> it's missing.
>
> So . . . any idea why the PURGE isn't working?
>
> In my VCL, my vcl_hash looks like this (I intend it to only hash on
> the request URL and compression):
>
> sub vcl_hash {
>  set req.hash += req.url;
>
>  if (req.http.Accept-Encoding ~ "gzip") {
>    set req.hash += "gzip";
>  } else if (req.http.Accept-Encoding ~ "deflate") {
>    set req.hash += "deflate";
>  }
>  return (hash);
> }
>
> And the checks for PURGE look like this (full VCL way below):
>
> sub vcl_hit {
>  if (req.request == "PURGE") {
>    set obj.ttl = 0s;
>    error 200 "Purged.";
>  }
>  if (!obj.cacheable) {
>    pass;
>  }
>
>  deliver;
> }
> sub vcl_miss {
>  if (req.request == "PURGE") {
>    error 404 "Not in cache.";
>  }
> }
>
> And in vcl_recv:
>
>  if (req.request == "PURGE") {
>    lookup;
>  }



More information about the varnish-misc mailing list