Accept-Encoding: gzip and the Vary header

Maxim Dounin mdounin at mdounin.ru
Thu Jun 4 14:25:40 UTC 2015


Hello!

On Thu, Jun 04, 2015 at 03:41:32PM +0200, Xavier Noria wrote:

> On Thu, Jun 4, 2015 at 3:11 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 
> The problem with Vary is that it causes bad effects on shared caches, in
> > particular, it normaly results in cache duplication.
> 
> 
> You mean that if client A requests a resource with Accept-Encoding: gzip,
> and client B without, and the resource has Cache-Control: public, then a
> shared cache would store the compressed and uncompressed responses thus
> having the content kind of repeated?

Not really. The main problem is that there is more than 2 
clients, and many of them will use different Accept-Encoding 
headers, e.g.:

gzip,deflate
gzip, deflate
gzip,deflate,sdch
gzip
deflate, gzip
identity
gzip,deflate,lzma,sdch
gzip;q=1.0,deflate;q=0.6,identity;q=0.3
gzip;q=1.0, deflate;q=0.8, chunked;q=0.6, identity;q=0.4, *;q=0
deflate
identity,gzip,deflate
gzip, deflate, peerdist
gzip, deflate, identity
gzip, x-gzip
gzip, deflate, compress

As a result, there will be many copies of compressed and 
uncompressed responses in the cache.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list