http-add-on icon indicating copy to clipboard operation
http-add-on copied to clipboard

Interceptor Proxy Support for Websockets

Open axisofentropy opened this issue 2 years ago • 6 comments

I'd like this http-add-on Interceptor Proxy to also support WebSocket connections.

Use-Case

Currently WebSocket connections are not supported through the Interceptor proxy. Per this discussion, HTTP requests with upgrade headers receive HTTP 403 responses: https://github.com/kedacore/http-add-on/discussions/618

I hope we can add logic to the Interceptor proxy to identify HTTP requests with these WebSocket headers and hand them off to a different HTTP handler.

Specification

I found an MIT-licensed library that produces an http.Handler object capable of proxying WebSocket connections. https://github.com/koding/websocketproxy/blob/master/websocketproxy.go

I imagine that when an incoming HTTP request tries to upgrade to a WebSocket connection, the Interceptor's existing Handler can hand it off to another Handler created using this library, which can support a proxied WebSocket connection.

While I'm familiar with the relevant networking protocols, I'm not very familiar with golang and its net.http library. Could this work? Can Handler objects be "chained"? Is this the right integration point?

Alternatively, could we add some pieces of that library to the existing proxy handler to support WebSockets?

axisofentropy avatar Apr 05 '23 19:04 axisofentropy

If this is not crazy, I may have time to work on it later this year.

axisofentropy avatar Apr 05 '23 19:04 axisofentropy

@axisofentropy did you try to enable http2 on the interceptor? https://github.com/kedacore/charts/blob/main/http-add-on/values.yaml#L105

fbalicchia avatar May 10 '23 12:05 fbalicchia

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 09 '23 14:07 stale[bot]

I have the same issue when trying to run Jupyter Notebooks using Voila. All the ipywidgets use wss. Since I can't change the auto transformation in Voila I can't use the http-add-on/interceptor. I also get a 403. WebSocket support would allow me to use the http-add-on, right now it's a blocker.

davidmnilsson avatar Sep 22 '23 20:09 davidmnilsson

#835 should fix the issue.

At least work for me with openvscode-server.

guilhem avatar Nov 08 '23 23:11 guilhem