PURGE http method and compression.

Phuwadon Danrahan Phuwadon at sanookonline.co.th
Mon Apr 28 13:36:27 CEST 2008


In my environment, we have the vcl_hash that uses "Accept-Encoding" as
one of hash keys. 

sub vcl_hash {
        set req.hash += req.url;
        set req.hash += req.http.host;
        if (req.http.Accept-Encoding ~ "gzip") {
               set req.hash += "gzip";
        }
        else if (req.http.Accept-Encoding ~ "deflate") {
                set req.hash += "deflate";
        }
        hash;
}

So, Varnish may have 3 hash versions of the same url. First is just for
no gzip/deflate client. Second is for gzip client. And third is for
deflate client.

If we need to purge the URL from backoffice (web server), we just purge
3 times for each URL by using CURL.

-----Original Message-----
From: varnish-misc-bounces at projects.linpro.no
[mailto:varnish-misc-bounces at projects.linpro.no] On Behalf Of
Poul-Henning Kamp
Sent: Monday, April 28, 2008 6:21 PM
To: Wichert Akkerman
Cc: varnish-misc at projects.linpro.no
Subject: Re: PURGE http method and compression. 

In message <4815AA34.5040300 at wiggy.net>, Wichert Akkerman writes:

>That's interesting. So the default VCL for HTTP PURGE requests will not

>purge all variants? How can a backend know which variants there are so
it 
>can purge all of them?

It probably can't, so if your backend returns "Vary:" headers, you
should
use the url.purge or hash.purge method.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by
incompetence.
_______________________________________________
varnish-misc mailing list
varnish-misc at projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list