Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunsmoke = gun + cowboy + tls + websocket #1620

Closed
etnt opened this issue Nov 15, 2023 · 3 comments
Closed

gunsmoke = gun + cowboy + tls + websocket #1620

etnt opened this issue Nov 15, 2023 · 3 comments

Comments

@etnt
Copy link

etnt commented Nov 15, 2023

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...?

@etnt
Copy link
Author

etnt commented Nov 15, 2023

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

@essen
Copy link
Member

essen commented Nov 15, 2023

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.

@etnt
Copy link
Author

etnt commented Nov 15, 2023

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!

@etnt etnt closed this as completed Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants