I used gzip compression in tomcat for my website. Below is the connector code-
<Connector SSLEnabled="true" clientAuth="false" maxThreads="150" port="9093" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/css,text/javascript, application/x-javascript,application/javascript"
/>
I checked size of one js file in browser console before compression. It was around 157KB and that time content-encoding was not present.
Then I implemented compression, checked size again and it was same i.e 157KB. This time content-encoding was present i.e gzip It means gzip compression implemented but js file didn't compress. Why? Any alternate?
Have you added the option
useSendfile="off"
inConnector
sector? Files larger than 48KB may not be compressed even ifcompression="on"
.See Tomcat conf-ref https://tomcat.apache.org/tomcat-8.0-doc/config/http.html and search
compression
.