kcmerrill / fetch-proxy

A proxy that routes web traffic to docker containers. Automagically.
MIT License
13 stars 7 forks source link

Proxy causes WebSocket upgrade to fail with a 400 code #25

Open jvendryes opened 7 years ago

jvendryes commented 7 years ago

When utilizing fetch-proxy for an application that uses WebSockets, the following error appears in console: WebSocket connection to 'ws://[redacted]/sockjs-node/223/rqzkemou/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

When accessing the same application by IP address (so outside of fetch-proxy), the error no longer happens and WebSockets behave properly.

Best guess is some changes are required here but I haven't looked closely yet: https://github.com/kcmerrill/fetch-proxy/blob/master/proxy.go#L20

jvendryes commented 7 years ago

The logs for fetch-proxy also show this: 2017/07/07 15:44:03 http: proxy error: net/http: request canceled

kcmerrill commented 7 years ago

Hey duder, I created a branch called "headers". Give it a go. I am wondering if me adding additional headers messes up the websocket headers and causes it to spaz out.

Either way, let me know if it works or if it doesn't. If you have an example container I can use, or another github project I can clone to test it out that would be 👌