HTTP2 compression on Tomcat 8.5.31

2018-07-25 Thread Aayush Dev
With Tomcat 8.5.31, I cant enable gzip compression with HTTP2 protocol. If
someone has successfully enabled compression on Tomcat 8.5 with HTTP2
protocol, please help me with correct configuration.

Things tried:
- tried with and without useSendfile="false" attribute under
UpgradeProtocol.
- turned off "useSendfile" by adding "sendfileSize=-1" init-param for
default servlet under conf/web.xml
- tried APR (with OpenSSL) connector too instead of NIO
- compression is not working with Chrome and Firefox (latest ver.)
- testing with default ROOT webapp to avoid any other conflicting setting
- gzip compression works with same setting on Tomcat 9.0.5
- using openjdk 10.0.1 (and tried with Oracle Java 1.8.0_144)

Using the following connector:












Request headers (from Chrome):
:authority: localhost:8443
:method: GET
:path: /tomcat.css
:scheme: https
accept: text/css,*/*;q=0.1
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
pragma: no-cache
referer: https://localhost:8443/
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Response headers (from Chrome):
accept-ranges: bytes
content-type: text/css
date: Wed, 25 Jul 2018 21:48:16 GMT
etag: W/"5931-1524878698000"
last-modified: Sat, 28 Apr 2018 01:24:58 GMT
status: 200


Thanks in advance.


Re: HTTP2 compression on Tomcat 8.5.31

2018-07-26 Thread Aayush Dev
Hi Pierre,

I am testing on windows. Tomcat 9.0.5 + HTTP2 + GZIP works with OpenJDK
10.0.1 (not with Java 1.8).

I am still trying to get Tomcat 8.5.31 + HTTP2 + GZIP working with OpenJDK
10.0.1.


On Wed, Jul 25, 2018 at 6:23 PM, Pierre Chiu  wrote:

> Hi Aayush,
>
> Are you saying this combo, Tomcat 9.0.5, Oracle Java 1.8.0_144, gzip works
> with HTTP2? Is it windows or linux?  That is good to know.
>
> Regarding tomcat 8.5.31, I don't think config file is the issue.
> Unfortunately, I don't have the skill to help the developer to debug the
> problem.
>
> see this thread in detail.
>
> https://www.mail-archive.com/users@tomcat.apache.org/msg128302.html <
> https://www.mail-archive.com/users@tomcat.apache.org/msg128302.html>
>
>
>
>
> > On Jul 25, 2018, at 6:05 PM, Aayush Dev  wrote:
> >
> > With Tomcat 8.5.31, I cant enable gzip compression with HTTP2 protocol.
> If
> > someone has successfully enabled compression on Tomcat 8.5 with HTTP2
> > protocol, please help me with correct configuration.
> >
> > Things tried:
> > - tried with and without useSendfile="false" attribute under
> > UpgradeProtocol.
> > - turned off "useSendfile" by adding "sendfileSize=-1" init-param for
> > default servlet under conf/web.xml
> > - tried APR (with OpenSSL) connector too instead of NIO
> > - compression is not working with Chrome and Firefox (latest ver.)
> > - testing with default ROOT webapp to avoid any other conflicting setting
> > - gzip compression works with same setting on Tomcat 9.0.5
> > - using openjdk 10.0.1 (and tried with Oracle Java 1.8.0_144)
> >
> > Using the following connector:
> >  >
> > protocol="org.apache.coyote.http11.Http11NioProtocol"
> >
> > port="8443"
> >
> > URIEncoding="UTF-8"
> >
> > maxPostSize="4096"
> >
> > maxHttpHeaderSize="1024000"
> >
> > maxThreads="2500"
> >
> > enableLookups="false"
> >
> > SSLEnabled="true"
> >
> > scheme="https"
> >
> > secure="true"
> >
> > compression="on"
> >
> > noCompressionUserAgents="gozilla,traviata"
> >
> > compressableMimeType=
> > "text/html,text/json,application/json,text/xml,text/plain,application/
> javascript,text/css,text/javascript,text/js"
> >
> > useSendfile="false"
> >
> > compressionMinSize="500">
> >
> >  >
> > className="org.apache.coyote.http2.Http2Protocol"
> >
> > compression="on"
> >
> > compressionMinSize="500"
> >
> > keepAliveTimeout="6"
> >
> > maxConcurrentStreamExecution="200"
> >
> > maxConcurrentStreams="200"
> >
> > maxHeaderSize="1024000"
> >
> > noCompressionUserAgents="gozilla,traviata"
> >
> > useSendfile="false" />
> >
> >  >
> > honorCipherOrder="true" protocols="TLSv1.1,TLSv1.2"
> >
> > ciphers=
> > "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_
> AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"
> >>
> >
> >  >
> > certificateKeystoreFile="conf/KeystoreFile.jks"
> >
> > certificateKeystorePassword="xx"
> >
> > certificateKeystoreType="JKS" />
> >
> > 
> >
> > 
> >
> > Request headers (from Chrome):
> > :authority: localhost:8443
> > :method: GET
> > :path: /tomcat.css
> > :scheme: https
> > accept: text/css,*/*;q=0.1
> > accept-encoding: gzip, deflate, br
> > accept-language: en-US,en;q=0.9
> > cache-control: no-cache
> > pragma: no-cache
> > referer: https://localhost:8443/
> > user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
> > (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
> >
> > Response headers (from Chrome):
> > accept-ranges: bytes
> > content-type: text/css
> > date: Wed, 25 Jul 2018 21:48:16 GMT
> > etag: W/"5931-1524878698000"
> > last-modified: Sat, 28 Apr 2018 01:24:58 GMT
> > status: 200
> >
> >
> > Thanks in advance.
>
>


Re: HTTP2 compression on Tomcat 8.5.31

2018-08-01 Thread Aayush Dev
Thanks Mark. Will wait for the release for our next production upgrade.

-Aayush

On Wed, Aug 1, 2018 at 5:08 PM, pc8...@gmail.com  wrote:

> Hurray!
>
>
> > Mark Thomas  於 2018年8月1日 下午4:27 寫道:
> >
> >> On 25/07/18 23:05, Aayush Dev wrote:
> >> With Tomcat 8.5.31, I cant enable gzip compression with HTTP2 protocol.
> If
> >> someone has successfully enabled compression on Tomcat 8.5 with HTTP2
> >> protocol, please help me with correct configuration.
> >
> > Clean Tomcat 8.5.x dev build
> > (should work with any release from 8.5.27 onwards)
> >
> > Java 9 (just so I don't have to configure the native library)
> >
> > Configure HTTP/2 and confirm, via start-up logs it is working.
> > - Uncomment the NIO HTTPS connector
> > - Add the UpgradeProtocol (copied from the APT HTTPS connector)
> > ... The ["https-jsse-nio-8443"] connector has been configured to support
> > negotiation to [h2] via ALPN
> >
> > Request /tomcat.css (a compressible resource)
> >
> > 5581 bytes
> >
> > Uncompressed. As expected.
> >
> > Edit server.xml and add attribute compression="on" to UpgradeProtocol
> > (making sure it is added to the element nested in the NIO HTTPS
> Connector)
> >
> > Restart Tomcat
> >
> > Request /tomcat.css
> >
> > Hmm. Still not compressed...
> >
> > Double check config. Looks OK...
> >
> > Time to fire up remote debugging in the IDE.
> >
> > Find bug. Fix bug. Retest.
> >
> > 1712 bytes. That is more like it.
> >
> > The fix will be in the next release. As we are at the start of the month
> > I'm hoping to start the next 9.0.x and 8.5.x releases in the next few
> days.
> >
> > Mark
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: HTTP2 compression on Tomcat 8.5.31

2018-08-02 Thread Aayush Dev
Just want to point out there is no useSendfile attribute for Upgrade
Protocol in documentation for Tomcat 8.5 (
https://tomcat.apache.org/tomcat-8.5-doc/config/http2.html). It is present
in Tomcat 9 (https://tomcat.apache.org/tomcat-9.0-doc/config/http2.html).

On Wed, Aug 1, 2018 at 6:24 PM, Aayush Dev  wrote:

> Thanks Mark. Will wait for the release for our next production upgrade.
>
> -Aayush
>
> On Wed, Aug 1, 2018 at 5:08 PM, pc8...@gmail.com  wrote:
>
>> Hurray!
>>
>>
>> > Mark Thomas  於 2018年8月1日 下午4:27 寫道:
>> >
>> >> On 25/07/18 23:05, Aayush Dev wrote:
>> >> With Tomcat 8.5.31, I cant enable gzip compression with HTTP2
>> protocol. If
>> >> someone has successfully enabled compression on Tomcat 8.5 with HTTP2
>> >> protocol, please help me with correct configuration.
>> >
>> > Clean Tomcat 8.5.x dev build
>> > (should work with any release from 8.5.27 onwards)
>> >
>> > Java 9 (just so I don't have to configure the native library)
>> >
>> > Configure HTTP/2 and confirm, via start-up logs it is working.
>> > - Uncomment the NIO HTTPS connector
>> > - Add the UpgradeProtocol (copied from the APT HTTPS connector)
>> > ... The ["https-jsse-nio-8443"] connector has been configured to support
>> > negotiation to [h2] via ALPN
>> >
>> > Request /tomcat.css (a compressible resource)
>> >
>> > 5581 bytes
>> >
>> > Uncompressed. As expected.
>> >
>> > Edit server.xml and add attribute compression="on" to UpgradeProtocol
>> > (making sure it is added to the element nested in the NIO HTTPS
>> Connector)
>> >
>> > Restart Tomcat
>> >
>> > Request /tomcat.css
>> >
>> > Hmm. Still not compressed...
>> >
>> > Double check config. Looks OK...
>> >
>> > Time to fire up remote debugging in the IDE.
>> >
>> > Find bug. Fix bug. Retest.
>> >
>> > 1712 bytes. That is more like it.
>> >
>> > The fix will be in the next release. As we are at the start of the month
>> > I'm hoping to start the next 9.0.x and 8.5.x releases in the next few
>> days.
>> >
>> > Mark
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> > For additional commands, e-mail: users-h...@tomcat.apache.org
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>