简体   繁体   English

运行Websockets Secure(WSS)的node.js服务器上的SSL证书

[英]SSL certs on node.js servers running websockets secure (WSS)

So I have a bunch of express node servers that run websockets (ws) just fine and i am looking to transition into using wss (websockets secure). 因此,我有一堆运行websockets(ws)的快速节点服务器,而且我希望过渡到使用wss(websockets安全)。 I've got the https server running and wss even works on local host using a self-signed certificate. 我已经运行了https服务器,并且wss甚至可以使用自签名证书在本地主机上运行。 But my problem is getting it working in a production environment. 但是我的问题是要使其在生产环境中工作。 It seems self-signed certs close silently (without the user getting a prompt to sign) for wss connections. 似乎自签名证书无提示地关闭了wss连接(用户未提示签名)。 When I try to use a purchased cert from a domain authority, i get "NET::ERR_CERT_COMMON_NAME_INVALID" trying to access the node server via https directly in the browser. 当我尝试使用从域授权机构购买的证书时,遇到“ NET :: ERR_CERT_COMMON_NAME_INVALID”,尝试直接在浏览器中通过https访问节点服务器。 With wss connection requests, I get SSL errors like "connection refused". 使用wss连接请求,我会收到SSL错误,例如“连接被拒绝”。

The common name on the purchased cert is my domain name and the node.js server is NOT connected with my domain name (it's simply an IP address). 购买的证书上的通用名称是我的域名,而node.js服务器未与我的域名连接(这仅仅是IP地址)。 Is that what's causing the trouble? 那是什么原因引起的麻烦? If so, how what do I enter as the common name when I purchase a cert? 如果是这样,购买证书时如何输入通用名称? Can I use the ip address of the node server which serves the wss connection? 我可以使用为wss连接服务的节点服务器的ip地址吗? Is that the only way to do it? 那是唯一的方法吗?

Is there any way around purchasing a cert on every node.js server I want to run wss on? 是否可以在要在其上运行wss的每个node.js服务器上购买证书? I'm aware of multi-domain certs, but don't know much about them. 我知道多域证书,但是对它们知之甚少。

With websockets specify the domain name instead of the ip address, if you are using a https connection 如果您使用的是https连接,则使用websockets指定域名而不是IP地址

for example: 例如:

test_conn = new WebSocket('wss://domain_name.com/websocket_test')

Instead of: 代替:

test_conn = new WebSocket('wss://210.56.78.90/websocket_test')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM