nginx websocket upgstream模块开发
我正在尝试让 nginx 反向代理 websocket 连接,以便我可以在同一端口上托管 Rails 应用程序。
考虑到我们忽略了 8 字节内容长度握手问题,我对这个主题有几个问题:
- 如果我要为当前的 http 上游实现 1.1 keep-alive,这是否允许我使用 nginx 作为反向代理后端的node.js websocket服务器实例?
- (我不确定我是否理解正确)考虑到我正在实现上游 keepalive,这是否意味着客户端和 nginx 之间的每个连接也会导致 nginx 和 node.js 后端之间的连接,只要客户端是否已连接到 websocket?如果是这种情况,是否与 nginx 的连接处理方式冲突?
- 如果 1. 成立,您能给我一些关于我将如何实现这一点的提示吗?
谢谢, 礼萨
P.S.有一个 ngx-upstream-keepalive 模块不支持 http。 http://mdounin.ru/hg/ngx_http_upstream_keepalive/
I'm trying to get nginx to reverse proxy websocket connections so that i can host a rails application on the same port.
Considering we neglect the 8 byte content-length handshake issue, I have a couple of questions on this topic:
- if i were to implement 1.1 keep-alive for current http upstream, would that allow me to use nginx as a reverse proxy for a node.js websocket server instance at the backend?
- (and i'm not sure if i understand this correctly) considering i'm implementing upstream keepalive, would that mean that every connection between client and nginx also results in a connection between nginx and the node.js backend for as long as the client is connected to the websocket? if that's the case is that in any way conflicting with nginx' way of connection handling?
- if 1. holds, can you give me any hints on how i would approach implementing this?
Thanks,
Reza
P.s. There is an ngx-upstream-keepalive module which doesn't support http. http://mdounin.ru/hg/ngx_http_upstream_keepalive/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
https://github.com/yaoweibin/nginx_tcp_proxy_module
https://github.com/yaoweibin/nginx_tcp_proxy_module