小程序項(xiàng)目使用GatewayWorker開(kāi)發(fā),但是WSS一直成功不了。
我按照手冊(cè)里設(shè)置了Apache 反向代理,
<VirtualHost *:80>
DocumentRoot "/var/www/html/tetaa"
ServerName tetaa.brightcloud-tech.com
#LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
ErrorLog ${APACHE_LOG_DIR}/quant/error.log
CustomLog ${APACHE_LOG_DIR}/quant/access.log combined
# a add
# Proxy Config
SSLProxyEngine on
ProxyRequests Off
ProxyPass /wss ws://127.0.0.1:7272
ProxyPassReverse /wss ws://127.0.0.1:7272
# 添加 SSL 協(xié)議支持協(xié)議,去掉不安全的協(xié)議
SSLProtocol all -SSLv2 -SSLv3
# 修改加密套件如下
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
SSLCertificateFile /etc/apache2/cert/public.pem
SSLCertificateKeyFile /etc/apache2/cert/214675772330006.key
# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
# concatenation of PEM encoded CA certificates which form the
# certificate chain for the server certificate. Alternatively
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
SSLCertificateChainFile /etc/apache2/cert/chain.pem
# a add
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory "/var/www/html/tetaa">
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
Require all granted
</Directory>
</VirtualHost>
可是小程序還是一連接就斷開(kāi)。
在Gateway中可以出發(fā)Onconnect事件,但是同樣會(huì)斷開(kāi)。 請(qǐng)問(wèn)是哪里設(shè)置錯(cuò)了嗎?
WebSocket connection to 'wss://tetaa.brightcloud-tech.com/' failed: Error during WebSocket handshake: Unexpected response code: 200
這是小程序段斷開(kāi)連接時(shí)的Log