Bug 57837

Summary: add "text/css" to default of compressableMimeType
Product: Tomcat 7 Reporter: Ralf Hauser <hauser>
Component: ConnectorsAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   

Description Ralf Hauser 2015-04-20 19:38:43 UTC
as per https://tomcat.apache.org/tomcat-7.0-doc/config/http.html

I put compression="10" into the server.xml, but https://developers.google.com/speed/pagespeed claims gzip is not yet activated.

I have also tried
 compression="on" compressionMinSize="512"

with the same result.

See https://p4u.ch/page_speed_rh
Comment 1 Ralf Hauser 2015-04-21 06:39:19 UTC
It is not APR as discussed in http://marc.info/?l=tomcat-user&m=139280091513414&w=2
Comment 2 Violeta Georgieva 2015-04-21 06:50:19 UTC
Hi,

By default mime types that will be compressed are text/html,text/xml,text/plain.

compressableMimeType	
The value is a comma separated list of MIME types for which HTTP compression may be used. The default value is text/html,text/xml,text/plain.

Are you requesting resources with such mime types?

Regards,
Violeta
Comment 3 Rainer Jung 2015-04-21 08:22:52 UTC
The google test lists a css as an example. We should probably add css and JavaScript files to the default list.

To Ralf: Does ist work for the mime types cited by Violeta? You can change the list with the attribute "compressableMimeType", which is a comma separated list, default value "text/html,text/xml,text/plain".
Comment 4 Ralf Hauser 2015-04-21 13:24:51 UTC
Thanks Rainer, this made google happy.

title was: "compression" in server.xml not considered sufficient by google"

==> I suggest to add text/css do the default of compressableMimeType

   ----> changed to enhancement
Comment 5 Christopher Schultz 2015-04-21 14:41:04 UTC
Don't forget that the availability of sendFile trumps any compression configuration.
Comment 6 Mark Thomas 2015-04-28 11:24:31 UTC
Thanks for the report. This has been fixed in trunk (for 9.0.x), tc8.0.x/trunk for 8.0.22 onwards and tc7.0.x/trunk for 7.0.62 onwards.
Comment 7 mgrigorov 2015-04-28 11:46:16 UTC
I agree with Rainer that JavaScript should be whitelisted as well.

@Mark: do you see problem by adding text/javascript and application/javascript to the list?
Comment 8 romain.manni-bucau 2015-04-28 11:47:27 UTC
+1 for javascript as well
Comment 9 Violeta Georgieva 2015-04-28 12:34:28 UTC
+1 for javascript