deislabs / osiris

A general purpose, scale-to-zero component for Kubernetes
MIT License
463 stars 51 forks source link

WebSocket Support #35

Open SamCHogg opened 5 years ago

SamCHogg commented 5 years ago

Environment:

What happened? I have been starting to use this project to scale down our preview environments (which is really awesome btw!). However I came across issues when I tried to use this one of our services which relies on websockets. The browser gets a '502 Bad Gateway' response from the websocket requests. Checking the logs from the proxy sidecar I see this error:

http: proxy error: internal error: 101 switching protocols response with non-writable body

So I was wondering if websockets are supported, and what I might be missing to get this working?

What you expected to happen? Websocket requests work correctly through the proxy.

SamCHogg commented 5 years ago

Looking at the implementation here: https://github.com/deislabs/osiris/blob/4f8deeed3373fd948d89977f5e77e4776f424cfa/pkg/net/http/httputil/reverseproxy.go#L506-L548

And based on this comment: https://github.com/golang/go/issues/26937#issuecomment-435623896

I see that the implementation used relies on Go 1.12 features, where as I believe this project is complied with Go 1.11. The comment below shows an implementation which works with 1.11.

krancour commented 5 years ago

There is no support for web sockets at the moment, nor do I believe it's planned. (This project is relatively dormant at the moment.)

I see that the implementation used relies on Go 1.12 features, where as I believe this project is complied with Go 1.11.

Relevant Go 1.12 features were replicated in our own source tree. Now that Go 1.12 is available, we can probably undo that.

SamCHogg commented 5 years ago

Relevant Go 1.12 features were replicated in our own source tree. Now that Go 1.12 is available, we can probably undo that.

Ah, I see that now. Makes sense.

There is no support for web sockets at the moment, nor do I believe it's planned. (This project is relatively dormant at the moment.)

That is sad to hear, especially with how some projects rely on websockets, but it's at least good to know.