Varnish Serves only uncompressed objects if they are requested first

Jeff Anderson jeff at funnyordie.com
Thu Dec 4 20:59:37 CET 2008


Our app servers are sending the Vary on the Accept-Encoding when  
compression is requested.  If compression is not requested they do not  
perform the Vary.  Does that mean we should find a way to send a Vary:  
Accept-Encoding:  null,gzip,deflate or something?  Is there a 'no  
compression' accept-encoding header?


On Dec 2, 2008, at 10:36 PM, Per Buer wrote:

> 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/
>
> _______________________________________________
> 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