PURGE http method and compression.

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Apr 28 15:22:49 CEST 2008

In message <FB69F04A751F144082624ED1C482C4DDE6B449 at th10ex2.sanookonline.co.th>,
 "Phuwadon Danrahan" writes:
>In my environment, we have the vcl_hash that uses "Accept-Encoding" as
>one of hash keys.=20
>sub vcl_hash {
>        set req.hash +=3D req.url;
>        set req.hash +=3D req.http.host;
>        if (req.http.Accept-Encoding ~ "gzip") {
>               set req.hash +=3D "gzip";
>        }
>        else if (req.http.Accept-Encoding ~ "deflate") {
>                set req.hash +=3D "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.

You only have to do one purge if you use hash.purge: just let the
regexp match everything up to, but not including gzip/deflate

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.

More information about the varnish-misc mailing list