Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Connecting to Jetty 9.3.8 http2 connector without ALPN

Hi,

On Fri, Mar 18, 2016 at 12:12 PM, Fabian Lange <lange.fabian@xxxxxxxxx> wrote:
> Hi Simone,
> ok, I guess I understood this now.
> If the server is configured to do ALPN, there is no way to talk to it directly.

Uh, no.
ALPN tries to negotiate a protocol.
If it can, it uses it.
If it cannot, it falls back to a default protocol.

The problem is only deciding what is the default protocol to fallback to.

If you decide that it's HTTP/2, then your client will work even if you
have ALPN on server: the client won't send ALPN, the server will
fallback to HTTP/2.
If you have a browser hitting the same port, it will work because the
browser will send ALPN.
If you have an old browser that does not support HTTP/2, then it won't
be able to connect: it won't send ALPN, the server will fallback to
HTTP/2, but the client won't be able to understand it.

The alternative is to *not* use ALPN on the server.
Then your client will work: won't send ALPN, server speaks HTTP/2,
client speaks HTTP/2, all good.
A recent browser won't work: it will send ALPN, the server starts
speaking HTTP/2, the browser will fallback to HTTP/1.1 because it was
not able to negotiate a protocol, and it won't understand the server.
An old browser also won't work.

> Because I control both sides, I can make this work, but for people who
> want to talk to a server which supports h2 via alpn, the only way is
> to do alpn.

No, see above: you can skip ALPN if you *know* the server speaks HTTP/2.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top