reverse_proxy_plug
reverse_proxy_plug copied to clipboard
Websocket support?
This the most awesome package for proxying, but it does not work with websockets, the error code 426 Upgrade Required
received when i try to proxy "ws://" request. I found that "connection" and "upgrade" are disabled in remove_hop_by_hop_headers
function. Are you going to support WS?
Hi, thanks for your interest!
This is definitely something we would like to implement properly, but unfortunately it is not on our priority list right now. In the meantime we welcome pull requests towards this.
Any recommendations to start this issue ? Websockex as client ? Purely forwarding the frames TCP ?
Soon as this pull request(https://github.com/elixir-plug/plug_cowboy/pull/88) is merged, I will try to implement the websocket proxying with gun(https://github.com/ninenines/gun) as internal client for proxing frames to the upstreams.
Ok the support for the websocket has been merged into plug_cowboy: https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html#module-websocket-support
@minidfx I am interested in proxying websockets too, did you manage to find a solution?
Yep, I moved to nginx ;)
@minidfx attaboy ;). Okay in that case I need to give it a shot myself as I need it done programmatically :/
But you can check the package plug_cowboy, recently the support of the websocket was added, it was really not easy to send the messages to the backend server and reply to the clients.
I spend too much time without a good result with websocket in this project: https://github.com/minidfx/elixir-reverse-proxy
Useful links:
- https://github.com/elixir-plug/plug_cowboy
- https://ninenines.eu/docs/en/cowboy/2.9/guide/ws_protocol/
- https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html#module-websocket-support
Have fun!