Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Question about http3 in embedded Jetty

Hi,

I am running an embedded Jetty 11.0.11 server. Up until now we have been using http2 using the following embedding code:

            val http1 = new HttpConnectionFactory(httpsConfig)
            val http2 = new HTTP2ServerConnectionFactory(httpsConfig)
            val alpn = new ALPNServerConnectionFactory
            alpn.setDefaultProtocol(http1.getProtocol)
            val ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol)             val http2Connector = new ServerConnector(server,ssl,alpn,http2,http1)
            if (address != null) http2Connector.setHost(address)
            http2Connector.setPort(port)
            http2Connector.setIdleTimeout(1000L * idleTimeout)
            server.addConnector(http2Connector)

In an attempt to add http3 support I changed this to:

            val http1 = new HttpConnectionFactory(httpsConfig)
            val http2 = new HTTP2ServerConnectionFactory(httpsConfig)
            val alpn = new ALPNServerConnectionFactory
            alpn.setDefaultProtocol(http1.getProtocol)
            val ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol)             val http2Connector = new ServerConnector(server,ssl,alpn,http2,http1)
            if (address != null) http2Connector.setHost(address)
            http2Connector.setPort(port)
            http2Connector.setIdleTimeout(1000L * idleTimeout)
//begin addition
            val http3 = new HTTP3ServerConnectionFactory(httpsConfig)
            val http3Connector = new HTTP3ServerConnector(server,sslContextFactory,http3)
            http3Connector.setPort(port + 1)
            server.addConnector(http3Connector)
//end addition
            server.addConnector(http2Connector)

Using port=8443 I can see that apart from a TCP listener on that port a UDP listener is present on 8444. And in the responses there is a header

alt-svc: h3=":8444"

present to indicate the h3 alternative. But with every browser I tried (Chrome, Brave, FireFox) the requests seem to be done via http2 only. The additional header shows up but no attempts seem to be made to use the http3 connector. Since the browsers (especially Firefox) should support http3 by default I must be doing something wrong.

I am testing this on localhost with a locally mapped domainname (https://localhost.jambo.software:8443) and a matching wildcard-certificate. Everything works as it has always done but the http3 stuff just does not kick in. Can anybody see my error(s)?

Cheers,

Silvio



Back to the top