Not seeing a successful purge

John Norman john at 7fff.com
Fri Feb 12 16:50:55 CET 2010


Thanks, Laurence. But . . .

Am I misreading the varnishlog I quoted? The Accept-Encoding headers
seem both to contain gzip:

Here's the Accept-Encoding from the browser:

4 RxHeader     c Accept-Encoding: gzip,deflate

Here it is from the PURGE:

4 RxHeader     c Accept-Encoding: gzip,identity

(Both quoted from my original message.)

They both contain gzip, so the hash should be the URL + gzip:

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);
}

So, I'm still not seeing why the purge isn't hitting:

>From the browser's GET:

4 VCL_return   c hash
4 Hit          c 904319089
4 VCL_call     c hit
4 VCL_return   c deliver

>From the PURGE request:

4 VCL_call     c hash
4 VCL_return   c hash
4 VCL_call     c miss
0 Debug        - "VCL_error(404, Not in cache.)"

On Fri, Feb 12, 2010 at 5:49 AM, Laurence Rowe <l at lrowe.co.uk> wrote:
> 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