tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: serving pre-compressed files
Date Sat, 11 Jun 2011 15:40:02 GMT
On 09.06.2011 18:22, Christopher Schultz wrote:
> Jesse,
> On 6/9/2011 8:34 AM, Jesse Farinacci wrote:
>> I just wrote a
>> quick javax.servlet.Filter. It sanity checks: 1) no ?gzip=false
>> parameter (a la Tomcat's compression filter), and 2) Accept-Encoding:
>> {,x-}gzip in any of the headers, and 3)  that "" new
>> File(request.getContextPath().substring(1) +
> You might want to check out how Apache httpd does the same type of
> thing. It uses the "Vary" response header which may be a bit more polite.

Vary is about something else, but also important. It tels intermediate
proxies which are located between the browser and Tomcat, that the
content they see does not only depend on the URL, but also on the value
of additional headers.

Without vary, a compressed content would be put in the intermediate
cache and then served later to all other browsers using the same cache
and asking for the same content - even if they don't support
compression. Usually the User-Agent is added to Vary, but that kind of
blows up the cache, because it will then cache the content once pr
User-Agent string - and there are gazillions of those.

Something else to consider: make sure you send the correct Content-Type
header back, even after adding the gzip file extension.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message