caddy icon indicating copy to clipboard operation
caddy copied to clipboard

Support WebSockets over HTTP/2 (RFC8441)

Open bt90 opened this issue 2 years ago • 10 comments

https://datatracker.ietf.org/doc/html/rfc8441

The standard is already supported by Firefox and Chrome

Blocked by https://github.com/golang/go/issues/53209

bt90 avatar Jun 05 '23 17:06 bt90

As suggested by @francislavoie

https://phpc.social/@francislavoie/110492709845091053

(also thanks @icing for the idea)

bt90 avatar Jun 05 '23 17:06 bt90

According to rfc 8441, websocket over h2 requires SETTINGS_ENABLE_CONNECT_PROTOCOL to be sent by h2 server, currently golang doesn't allow sending custom h2 settings.

Also the method has been changed from GET to CONNECT, so connection establishment is somewhat different. Do you know of any server that supports websocket over h2 so I can test it @bt90?

WeidiDeng avatar Jun 06 '23 00:06 WeidiDeng

By the way, x/net/websocket is discontinued. This should go to x/net/http2 instead.

WeidiDeng avatar Jun 06 '23 00:06 WeidiDeng

This actually will partly modify reverse_proxy's handling of 101 response based on whether client is using http2 if it is ever implemented.

WeidiDeng avatar Jun 06 '23 01:06 WeidiDeng

Related changes required here upstream.

WeidiDeng avatar Jun 06 '23 03:06 WeidiDeng

Thank you for looking into this, @WeidiDeng :smiley:

mholt avatar Jun 06 '23 03:06 mholt

According to rfc 8441, websocket over h2 requires SETTINGS_ENABLE_CONNECT_PROTOCOL to be sent by h2 server, currently golang doesn't allow sending custom h2 settings.

See https://github.com/golang/go/issues/53208

establishment is somewhat different. Do you know of any server that supports websocket over h2 so I can test it @bt90?

@icing is adding support for Apache :wink:

bt90 avatar Jun 06 '23 04:06 bt90

Lighttpd supports ws over h2 since version 1.4.65.

Please check links below: https://redmine.lighttpd.net/issues/3151 https://www.phoronix.com/news/lighttpd-1.4.65

zhangjun-qcqi avatar Jun 29 '23 04:06 zhangjun-qcqi

@bt90 You can try 6567 to see how it actually works.

WeidiDeng avatar Sep 10 '24 14:09 WeidiDeng