ninenines / cowboy

Small, fast, modern HTTP server for Erlang/OTP.

Home Page:https://ninenines.eu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gunsmoke = gun + cowboy + tls + websocket

etnt opened this issue · comments

Hi,

I have problems getting gun + cowboy talking over TLS using websockets to work.
I have created a minimal example that reproduces the problem.

https://github.com/etnt/gunsmoke

It seems like a TLS "handshake" is successful but then the connection goes down
and the client side gets a:

gunsmoke_client169: handle_info, client got: {gun_error,<0.308.0>,
                                              #Ref<0.3146592152.1217134599.144411>,
                                              {stream_error,protocol_error,
                                               'Stream reset by server.'}}

Could perhaps be something wrong with my self-signed certs...or something else...?

Forgot to mention that I'm using OTP-25.

You are connecting over HTTP/2 which requires a setting to be set for it to work (extended connect). You need to set enable_connect_protocol to true in both Cowboy and Gun. Please check test/rfc8441_SUITE.erl for examples.

Ahh...I missed that part in the docs saying the prefered protocols for TLS per default is: [http2,http];
so I just removed http2 from that protocols option list and it worked.
Great, thanks!