我正在尝试使用html 5 websockets连接到我的websocket服务器。 直接连接工作正常,但是当我试图隐藏我的服务器后面的Apache代理不起作用。
它结束了:
var ws = new WebSocket("wss://www.example.com/generator/wss/"); undefined WebSocket connection to 'wss://www.example.com/generator/wss/' failed: Error during WebSocket handshake: Invalid status line
但如果我直接连接到wss://www.example.com:9002,那么它的工作原理…
这是我的apacheconfiguration:
<VirtualHost *:80> ServerName www.example.com ServerAdmin [email protected] ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Redirect permanent / https://www.example.com/ </VirtualHost> <VirtualHost *:443> ServerName www.example.com ServerAdmin [email protected] SetEnv EXAMPLE_SERVER_ENVIROMENT production SSLEngine on SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS" SSLCertificateFile /etc/ssl/certs/apache/www.example.crt SSLCertificateKeyFile /etc/ssl/certs/apache/private.key SSLCertificateChainFile /etc/ssl/certs/apache/sub.class1.server.sha2.ca.pem ProxyPass /generator/wss wss://127.0.0.1:9002/ ProxyPassReverse /generator/wss wss://127.0.0.1:9002/ ProxyPreserveHost On ProxyRequests Off ProxyVia On DocumentRoot /opt/example/prod/public <Directory "/opt/example/prod/public"> Order allow,deny AllowOverride All Allow from all Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
任何想法,为什么它不工作? 谢谢
那么,所以我不知道究竟是哪里错误,但是当我升级apache2从2.4.7到2.4.16,那么它正在工作…