【发布时间】:2018-03-10 10:40:25
【问题描述】:
我需要一些关于通过 https 进行 netty socket io 的帮助。我已经将它放在我的本地环境中,但没有放在具有安全域的服务器上。服务器启动,但客户端无法连接。尝试使用 IP 和域名启动套接字服务器。为了让服务器在 setHostname 方法中以域名作为主机名值开始,我在 /etc/hosts 文件中添加了一个条目,如下所示
127.0.0.1 本地主机 example.com
通过将 example.com 作为主机名来启动套接字服务器,但客户端无法通过 https 使用相同的主机名进行连接,如下所示
var socket = io.connect('https://example.com:10443')
尝试使用选项 - { secure: true, reconnect: true, rejectUnauthorized : false } 但同样的问题。
在服务器端我的配置如下
Configuration configuration = new Configuration();
configuration.setHostname("example.com");
configuration.setPort(10443);
configuration.setKeyStorePassword("mypassword");
InputStream stream = getClass().getClassLoader().getResourceAsStream("keystore.jks");
configuration.setKeyStore(stream);
jsk 文件是使用 keytool 命令为同一域 (example.com) 创建的
对于要被套接字服务器使用的端口 - 10443,是否还有更多工作要做?或者还有什么其他的配置要做吗?
【问题讨论】: