On 20/10/2011 09:11, Amos Jeffries wrote: > On 20/10/11 20:11, Kaiwang Chen wrote: >> So Squid without the adapter will cache one copy of responses in only >> one encoding. > > Yes. > > > Will "Vary:Accept-Encoding" request header enable >> multiply copies? > > No. It tells Squid there are multiple variants with the same URL, and > to check the Accept-Encoding header against the one stored already > when deciding if it is a HIT. Hi, can I just double check your response above. Whilst Squid support might not be working (correctly) for Vary caching, my understanding is that Vary:Accept-Encoding is correct here to effectively cache both gzip'ed and non gzip'ed versions of the content? That said, if so, then this probably a good example of where post-cache response adaption (or code in squid) is useful? The problem seems to be that: ecap runs pre-cache, the ecap adaption gzips the data, the gzip'ed version is cached and now all cache hits return the gzip version regardless of Accept-Encoding? I think it's a non problem in that *I think* all modern browsers handle almost all assets gzip encoded whether they asked for it or not? In the past IE (6 and prior) was the odd one out with some bugs, and I have seen certain ISP proxies somehow mangle the response encoding header causing gziped content to be treated as plain text by the browser (not sure what happens, only have non technical customer reports). I *think* it's probably safe these days to blindly gzip everything in sight? Also when I last looked at the code, I think the ecap module a) only gzips a very small number of content types (ideally it should be expanded), and b) from memory I don't think it respected Accept-Encoding and compressed everything regardless? These are probably incorrect assertions, didn't recheck the code.... Thanks Ed W P.S. If someone wanted to investigate adding gzip to Squid directly then they would be looking for a hook into the code somewhere that handled all the client bound response bodies, with access to the original request to check Accept-Encoding headers. Where might someone look to add such code?