【发布时间】:2018-07-04 03:00:57
【问题描述】:
我有一个基于 websocket/nodejs 的聊天,它在 Chrome/Firefox/Edge/Opera 上运行良好(嵌入式 vpn 已禁用)。
但是,当我在 Opera 中打开嵌入式 VPN 时,我会随机断开连接。通常它会在大约 10 秒后发生,无论我是否发送消息。如果我发送消息,它们都会顺利通过,直到 10 秒左右后断开连接。即使没有任何消息,也会发生断开连接。
不确定是否可以关联,但是我在一个Apache Proxy后面使用nodejs,配置如下(HTTP在8081后面,WSS在8080后面,都封装在443中):
<VirtualHost MY_IP:443>
ServerName www.mydomain.com
SSLProxyEngine On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) wss://localhost:8080/$1 [P,L]
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
</VirtualHost>
<VirtualHost localhost:8081>
DocumentRoot /var/www/www.mydomain.com/
</VirtualHost>
我被卡住了,因为我在客户端或服务器上没有收到任何错误消息。
【问题讨论】:
标签: javascript node.js apache websocket opera