Enable HTTP2 with maven-jetty-plugin -


i've enabled http/2 connector on ssl jetty. when try connect browser 'err_ssl_protocol_error' error. if switch http/1.1 connector works fine.

here jetty configuration files:

<!-- ============================================================= --> <!-- configure jetty server instance id "server"       --> <!-- adding http connector.                                   --> <!-- configuration must used in conjunction jetty.xml --> <!-- ============================================================= --> <configure id="server" class="org.eclipse.jetty.server.server">      <new id="httpconfig" class="org.eclipse.jetty.server.httpconfiguration">         <set name="securescheme">https</set>         <set name="secureport"><property name="jetty.secure.port" default="8443" /></set>         <set name="outputbuffersize">32768</set>         <set name="requestheadersize">8192</set>         <set name="responseheadersize">8192</set>         <set name="sendserverversion">true</set>         <set name="senddateheader">false</set>         <set name="headercachesize">512</set>          <!-- uncomment enable handling of x-forwarded- style headers         <call name="addcustomizer">           <arg><new class="org.eclipse.jetty.server.forwardedrequestcustomizer"/></arg>         </call>         -->     </new>      <!-- =========================================================== -->     <!-- add http connector.                                       -->     <!-- configure o.e.j.server.serverconnector single     -->     <!-- httpconnectionfactory instance using common httpconfig  -->     <!-- instance defined in jetty.xml                               -->     <!--                                                             -->     <!-- consult javadoc of o.e.j.server.serverconnector ,     -->     <!-- o.e.j.server.httpconnectionfactory configuration    -->     <!-- may set here.                                       -->     <!-- =========================================================== -->     <call name="addconnector">         <arg>             <new id="httpconnector" class="org.eclipse.jetty.server.serverconnector">                 <arg name="server"><ref refid="server" /></arg>                 <arg name="acceptors" type="int"><property name="http.acceptors" default="-1"/></arg>                 <arg name="selectors" type="int"><property name="http.selectors" default="-1"/></arg>                 <arg name="factories">                     <array type="org.eclipse.jetty.server.connectionfactory">                         <!-- uncomment support proxy protocol                     <item>                           <new class="org.eclipse.jetty.server.proxyconnectionfactory"/>                         </item>-->                         <item>                             <new class="org.eclipse.jetty.server.httpconnectionfactory">                                 <arg name="config"><ref refid="httpconfig" /></arg>                             </new>                         </item>                     </array>                 </arg>                 <set name="host"><property name="jetty.host" /></set>                 <set name="port"><property name="jetty.port" default="8080" /></set>                 <set name="idletimeout"><property name="http.timeout" default="30000"/></set>                 <set name="solingertime"><property name="http.solingertime" default="-1"/></set>                 <set name="acceptorprioritydelta"><property name="http.acceptorprioritydelta" default="0"/></set>                 <set name="selectorprioritydelta"><property name="http.selectorprioritydelta" default="0"/></set>                 <set name="acceptqueuesize"><property name="http.acceptqueuesize" default="0"/></set>             </new>         </arg>     </call>  </configure>  <?xml version="1.0"?> <!doctype configure public "-//jetty//configure//en" "http://www.eclipse.org/jetty/configure_9_0.dtd">  <!-- ============================================================= --> <!-- configure https connector.                                  --> <!-- configuration must used in conjunction jetty.xml --> <!-- , jetty-ssl.xml.                                            --> <!-- ============================================================= --> <configure id="sslconnector" class="org.eclipse.jetty.server.serverconnector">      <!--call name="addifabsentconnectionfactory">         <arg>             <new class="org.eclipse.jetty.server.sslconnectionfactory">                 <arg name="next">http/1.1</arg>                 <arg name="sslcontextfactory"><ref refid="sslcontextfactory"/></arg>             </new>         </arg>     </call>      <call name="addconnectionfactory">         <arg>             <new class="org.eclipse.jetty.server.httpconnectionfactory">                 <arg name="config"><ref refid="sslhttpconfig" /></arg>             </new>         </arg>     </call-->      <!-- ============================================================= -->     <!-- configure http2 on ssl connector.                       -->     <!-- ============================================================= -->     <call name="addconnectionfactory">         <arg>             <new class="org.eclipse.jetty.http2.server.http2serverconnectionfactory">                 <arg name="config"><ref refid="sslhttpconfig"/></arg>                 <set name="maxconcurrentstreams"><property name="http2.maxconcurrentstreams" default="1024"/></set>             </new>         </arg>     </call>  </configure>  <?xml version="1.0"?> <!doctype configure public "-//jetty//configure//en" "http://www.eclipse.org/jetty/configure_9_0.dtd">  <!-- ============================================================= --> <!-- base ssl configuration                                        --> <!-- configuration needs used 1 or more   --> <!-- of jetty-https.xml or jetty-http2.xml                         --> <!-- ============================================================= --> <configure id="server" class="org.eclipse.jetty.server.server">      <!-- =========================================================== -->     <!-- create tls specific httpconfiguration based on        -->     <!-- common httpconfiguration defined in jetty.xml               -->     <!-- add securerequestcustomizer extract certificate ,    -->     <!-- session information                                         -->     <!-- =========================================================== -->     <new id="sslhttpconfig" class="org.eclipse.jetty.server.httpconfiguration">         <arg><ref refid="httpconfig"/></arg>         <call name="addcustomizer">             <arg><new class="org.eclipse.jetty.server.securerequestcustomizer"/></arg>         </call>     </new>      <!-- =========================================================== -->     <!-- add ssl connector no protocol factories              -->     <!-- =========================================================== -->     <call  name="addconnector">         <arg>             <new id="sslconnector" class="org.eclipse.jetty.server.serverconnector">                 <arg name="server"><ref refid="server" /></arg>                 <arg name="acceptors" type="int"><property name="ssl.acceptors" default="-1"/></arg>                 <arg name="selectors" type="int"><property name="ssl.selectors" default="-1"/></arg>                 <arg name="factories">                     <array type="org.eclipse.jetty.server.connectionfactory">                         <!-- uncomment support proxy protocol                     <item>                           <new class="org.eclipse.jetty.server.proxyconnectionfactory"/>                         </item>-->                     </array>                 </arg>                  <set name="host"><property name="jetty.host" /></set>                 <set name="port"><property name="ssl.port" default="443" /></set>                 <set name="port"><property name="port" default="9090" /></set>                 <set name="idletimeout"><property name="ssl.timeout" default="30000"/></set>                 <set name="solingertime"><property name="ssl.solingertime" default="-1"/></set>                 <set name="acceptorprioritydelta"><property name="ssl.acceptorprioritydelta" default="0"/></set>                 <set name="selectorprioritydelta"><property name="ssl.selectorprioritydelta" default="0"/></set>                 <set name="acceptqueuesize"><property name="ssl.acceptqueuesize" default="0"/></set>             </new>         </arg>     </call>      <!-- ============================================================= -->     <!-- create tls (ssl) context factory  later reuse           -->     <!-- ============================================================= -->     <new id="sslcontextfactory" class="org.eclipse.jetty.util.ssl.sslcontextfactory">         <set name="keystorepath"><property name="jetty.base" default="../" />/<property name="jetty.keystore" default="keystore.jks"/></set>         <set name="keystorepassword"><property name="jetty.keystore.password" default="storepwd"/></set>         <set name="keymanagerpassword"><property name="jetty.keymanager.password" default="storepwd"/></set>         <set name="truststorepath"><property name="jetty.base" default="../" />/<property name="jetty.truststore" default="truststore.jks"/></set>         <set name="truststorepassword"><property name="jetty.truststore.password" default="storepwd"/></set>         <set name="endpointidentificationalgorithm"></set>         <set name="needclientauth"><property name="jetty.ssl.needclientauth" default="false"/></set>         <set name="wantclientauth"><property name="jetty.ssl.wantclientauth" default="false"/></set>         <set name="excludeciphersuites">             <array type="string">                 <item>ssl_rsa_with_des_cbc_sha</item>                 <item>ssl_dhe_rsa_with_des_cbc_sha</item>                 <item>ssl_dhe_dss_with_des_cbc_sha</item>                 <item>ssl_rsa_export_with_rc4_40_md5</item>                 <item>ssl_rsa_export_with_des40_cbc_sha</item>                 <item>ssl_dhe_rsa_export_with_des40_cbc_sha</item>                 <item>ssl_dhe_dss_export_with_des40_cbc_sha</item>             </array>         </set>     </new> </configure> 

i'm using jetty-server, http2-server , jetty-alpn-server artifacts version 9.3.0.m1, there additional dependency added? i'm using jdk7.

thanks

it works jetty 9.3.0! need make sure alpn configured , use jdk8.

here configured maven-jetty-plugin:

<build>     <finalname>${project.artifactid}</finalname>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-compiler-plugin</artifactid>             <configuration>                 <source>1.8</source>                 <target>1.8</target>                 <verbose>true</verbose>             </configuration>         </plugin>         <plugin>             <groupid>org.eclipse.jetty</groupid>             <artifactid>jetty-maven-plugin</artifactid>             <version>${jetty-version}</version>             <configuration>                 <webappsourcedirectory>${project.build.directory}/${project.name}</webappsourcedirectory>                 <systemproperties>                     <force>true</force>                 </systemproperties>                 <scanintervalseconds>10</scanintervalseconds>                 <webappconfig>                     <contextpath>/</contextpath>                 </webappconfig>                 <jettyxml>../jetty.xml,../jetty-ssl.xml,../jetty-https.xml</jettyxml>                 <jvmargs>-xbootclasspath/p:${settings.localrepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn-version}/alpn-boot-${alpn-version}.jar</jvmargs>             </configuration>             <dependencies>                 <dependency>                     <groupid>org.eclipse.jetty.http2</groupid>                     <artifactid>http2-server</artifactid>                     <version>${jetty-version}</version>                 </dependency>                 <dependency>                     <groupid>org.eclipse.jetty</groupid>                     <artifactid>jetty-alpn-server</artifactid>                     <version>${jetty-version}</version>                 </dependency>             </dependencies>         </plugin>     </plugins> </build>  <properties>     <jetty-version>9.3.0.m2</jetty-version>     <alpn-version>8.1.0.v20141016</alpn-version> </properties> 

chose alpn artifact version according jdk version: http://eclipse.org/jetty/documentation/current/alpn-chapter.html

i added 2 connectiofactory before http2serverconnectionfactory

<call name="addconnectionfactory">     <arg>         <new class="org.eclipse.jetty.server.sslconnectionfactory">             <arg name="next">alpn</arg>             <arg name="sslcontextfactory"><ref refid="sslcontextfactory"/></arg>         </new>     </arg> </call>  <call name="addconnectionfactory">     <arg>         <new id="alpn" class="org.eclipse.jetty.alpn.server.alpnserverconnectionfactory">             <arg type="string">                 <property name="alpn.protocols" default="" />             </arg>             <set name="defaultprotocol">                 <property name="alpn.defaultprotocol" />             </set>         </new>     </arg> </call> 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -