No subject
Wed Jan 27 16:14:55 CET 2010
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 {
>> =A0set req.hash +=3D req.url;
>>
>> =A0if (req.http.Accept-Encoding ~ "gzip") {
>> =A0 =A0set req.hash +=3D "gzip";
>> =A0} else if (req.http.Accept-Encoding ~ "deflate") {
>> =A0 =A0set req.hash +=3D "deflate";
>> =A0}
>> =A0return (hash);
>> }
>>
>> And the checks for PURGE look like this (full VCL way below):
>>
>> sub vcl_hit {
>> =A0if (req.request =3D=3D "PURGE") {
>> =A0 =A0set obj.ttl =3D 0s;
>> =A0 =A0error 200 "Purged.";
>> =A0}
>> =A0if (!obj.cacheable) {
>> =A0 =A0pass;
>> =A0}
>>
>> =A0deliver;
>> }
>> sub vcl_miss {
>> =A0if (req.request =3D=3D "PURGE") {
>> =A0 =A0error 404 "Not in cache.";
>> =A0}
>> }
>>
>> And in vcl_recv:
>>
>> =A0if (req.request =3D=3D "PURGE") {
>> =A0 =A0lookup;
>> =A0}
>
More information about the varnish-misc
mailing list