Node.js - 具有 WebSocket 代理的良好 Web 服务器SSL 支持吗?
我真的很喜欢node.js,但是当你想运行多个websocket服务器并让它们都可以通过端口80访问时,它真的很复杂。
我目前正在运行nginx,但根据url将传入的websocket连接代理到不同的websocket服务器不可能,因为 nginx 不支持 http 1.1。
我尝试实现一个具有我自己的功能的网络服务器,但是当涉及到标头传递等时,它确实很复杂。另一件事是 SSL 支持。支持它并不容易。
那么,有谁知道做我提到的事情的好解决方案吗?
感谢您的帮助!
I really love node.js but it´s really complicating when you want to run multiple websocket servers and make them all accessible over port 80.
I'm currently running nginx, but proxying incoming websocket connections to the different websocket servers depending on the url is not possible because nginx does not support http 1.1.
I´ve tried to implement a webserver that has the functionality on my own, but it is really complicated when it comes to header passing etc. Another thing is SSL support. It´s not easy to support it.
So, does anyone know a good solution to do the things i mentioned?
Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用nodejitsu的 node-http-proxy 取得了很好的结果。正如他们的自述文件中所述,他们似乎支持 WebSockets。
WebSocket 示例(取自 GitHub 自述文件):
它的生产使用应该没有问题,因为它用于 nodejitsu.com。要将代理应用程序作为守护进程运行,请考虑使用 forever。
I had good results using node-http-proxy by nodejitsu. As stated in their readme, they seem to support WebSockets.
Example for WebSockets (taken from their GitHub readme):
It's production usage should be no problem since it is used for nodejitsu.com. To run the proxy app as a daemon, consider using forever.
较新版本的 nginx 实际上将支持 http/1.1 的反向代理。您可能需要 1.1.7 或更高版本。
在你的配置中尝试这样的事情:
这样做的好处是你可以在 nginx 上终止 SSL。
Newer versions of nginx actually will support reverse proxying for http/1.1. You probably want version 1.1.7 or greater.
Try something like this in your config:
Nice thing about this is that you can terminate SSL at nginx.