How to configure an embedded Jetty with HTTP/3 via API?

152 views Asked by At

I'm trying to implement a HTTP/3 using embedded Jetty with Java API. I have a running Jetty with HTTP/2 support, valid certificate on HTTPS default ports. I'm following the code in Jetty the documentation but it does not use HTTP/3. This look like:

    SslContextFactory.Server sslContextFactory = ...
    // Create and configure the HTTP/3 connector.
    HTTP3ServerConnectionFactory http3 = new HTTP3ServerConnectionFactory( httpConfig );
    HTTP3ServerConnector http3Connector = new HTTP3ServerConnector( this, sslContextFactory, http3 );
    http3Connector.setPort( 443 );
    addConnector( http3Connector );

From the follow question I add also a pem directory:

    Path pemDir = ...;
    Files.createDirectories( pemDir );
    http3Connector.getQuicConfiguration().setPemWorkDirectory( pemDir );

For HTTP/3 I add the follow extra libraries to my Jetty installation:

  • org.eclipse.jetty.http3:http3-server:10.0.17
  • org.eclipse.jetty.http3:http3-common:10.0.17
  • org.eclipse.jetty.http3:http3-qpack:10.0.17
  • org.eclipse.jetty.quic:quic-server:10.0.17
  • org.eclipse.jetty.quic:quic-common:10.0.17
  • org.eclipse.jetty.quic:quic-quiche-common:10.0.17
  • org.eclipse.jetty.quic:quic-quiche-jna
  • net.java.dev.jna:jna:5.11.0
  • org.mortbay.jetty.quiche:jetty-quiche-native:0.18.0

If I test it with curl-http3 then it work. If I test it with Chrome and Edge then it is ignored. Firefox does not load the application. With Firefox and Wireshark I see a quic communication.

I have test it with Java 11 and Java 17.

What I doing wrong? I am missing a library or some settings?

0

There are 0 answers