unit icon indicating copy to clipboard operation
unit copied to clipboard

Proxy Websocket Support

Open yujinqiu opened this issue 5 years ago • 6 comments

It's nice to see that unit have support proxy feature. Is there any plan to support proxy websocket protocol so I can use Unit to dynamic proxy my application.

yujinqiu avatar Dec 19 '19 03:12 yujinqiu

@VBart Why not support the standard Websocket protocol?

nginx:

  location /api-websocket {
     proxy_pass http://172.17.0.1:81/websocket;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "Upgrade";
 }

alx696 avatar Apr 16 '20 08:04 alx696

@VBart Why not support the standard Websocket protocol?

As the first step we need to support HTTP/1.1 for proxy. It's not supported yet, only HTTP/1.0.

VBart avatar Apr 17 '20 14:04 VBart

+1

Would be great to have support for both HTTP/1.1 and WebSocket proxying.

buzypi avatar May 17 '20 08:05 buzypi

Any update on this advancement? Nginx supports it just fine and I was under the assumption this codebase would share much from that of Nginx... Is a lot involved with making unit HTTP/1.1 compliant and thus able to proxy websockets?

@artemkonev

june07 avatar Jul 13 '20 22:07 june07

@june07 HTTP/1.1 support was introduced with https://github.com/nginx/unit/commit/65799c7252e56d287d967bf3f036a10d5764f82c (will be released with 1.19.0 in a few weeks or so), but without keep-alive connections cache. The next step will be to introduce keep-alive, and then we will be able to start working on WebSockets.

Unit doesn't share codebase with nginx and lot of things in Unit have been implemented differently.

VBart avatar Jul 15 '20 12:07 VBart

Any updates to this one? I just ran into this and realized that I can't (I think) proxy WS connections. It might just be bad config, though.

sureshjoshi avatar Aug 29 '21 05:08 sureshjoshi