Varnish Serves only uncompressed objects if they are requested first

Per Buer perbu at linpro.no
Wed Dec 3 07:36:46 CET 2008


Jeff Anderson skrev:
> It looks like if the first requested page is for an uncompressed page
> varnish will only deliver the uncompressed page from cache even if a
> compressed page is requested.

As long as you don't Vary: on the Accept-Encoding I guess that is
expected. Varnish doesn't not understand the Accept-Encoding header.

> (..)
> What could be causing this?  The only way to fix appears to be to add
> the lines below:
> 
> sub vcl_hash {
>  if (req.http.Accept-Encoding ~ "gzip" || req.http.Accept-Encoding ~
> "deflate") {
>    set req.hash += req.http.Accept-Encoding;
>  }

Either use the fix you suggested or add a Vary: Accept-Encoding on the
backend.

-- 
Per Buer - Leder Infrastruktur og Drift - Redpill Linpro
Telefon: 21 54 41 21 - Mobil: 958 39 117
http://linpro.no/ | http://redpill.se/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20081203/cdace9bd/attachment-0003.pgp>


More information about the varnish-misc mailing list