Tomcat8 Gzip Compression for CSS, JS -
i using tomcat8 , trying simulate gzip compression of css , js. have added entry in server.xml , follows
<connector port="8088" protocol="http/1.1" connectiontimeout="20000" redirectport="8443" compression="on" compressionminsize="2048" nocompressionuseragents="gozilla, traviata" compressablemimetype="text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json" />
and in html page have included script follows
<script type="text/javascript" src="extjs/ext-all-debug.js"></script>
but while accessing page, compression not happening , resposne header received follows.
remote address:[::1]:8088 request url:http://localhost:8088/test/extjs/ext-all-debug.js request method:get status code:200 ok
response headers
view source accept-ranges:bytes content-length:4585183 content-type:application/javascript date:wed, 03 jun 2015 00:34:12 gmt etag:w/"4585183-1427778288000" last-modified:tue, 31 mar 2015 05:04:48 gmt server:apache-coyote/1.1
request headers
view source accept:*/* accept-encoding:gzip, deflate, sdch accept-language:en-us,en;q=0.8 connection:keep-alive host:localhost:8088 referer:http://localhost:8088/test/index.html user-agent:mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.81 safari/537.36
please me find went wrong here. same happening when setting in remote server.
i added attribute usesendfile value false.
the manual says:
(bool)use attribute enable or disable sendfile capability. default value true. note use of sendfile disable compression tomcat may otherwise have performed on response.
my tomcat8 compressing large html-file.
my connector:
<connector port="8080" protocol="http/1.1" connectiontimeout="20000" usesendfile="false" compression="on" compressionminsize="2048" nocompressionuseragents="gozilla, traviata" compressablemimetype="text/html,text/xml,text/plain,text/css" redirectport="8443" />
fiddler info:
http/1.1 200 ok server: apache-coyote/1.1 accept-ranges: bytes etag: w/"560012-1444044890000" last-modified: mon, 05 oct 2015 11:34:50 gmt content-type: text/html transfer-encoding: chunked content-encoding: gzip vary: accept-encoding date: tue, 06 oct 2015 08:53:53 gmt
Comments
Post a Comment