我尝试使用httpd代理和反向代理配置websockets,但似乎无法正常工作。如果我直接使用tomcat服务器,一切都很好,但如果通过apache httpd调用它,则响应状态为200。这意味着apache httpd无法解释websocket请求并切换协议,对吗?
这是我的应用程序的httpd配置:
这是我的应用程序的httpd配置:
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
Listen 443 https
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
SSLSessionCache shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout 300
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
<VirtualHost 10.224.130.50:80>
ServerName myhost
Redirect permanent / https://myhost/
</VirtualHost>
<VirtualHost 10.224.130.50:443>
ServerName myhost
ErrorLog logs/myhost.error.log
CustomLog logs/myhost.access.log common
ProxyPass /ws/ wss://localhost:8443/ws/ retry=0
ProxyPassReverse /ws/ wss://localhost:8443/ws/ retry=0
ProxyPass / https://myhost:8443/ connectiontimeout=600 timeout=1200
ProxyPassReverse / https://myhost:8443/
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLCertificateFile "/etc/pki/tls/certs/myhost.cer"
SSLCertificateKeyFile "/etc/pki/tls/private/myhost.key"
</VirtualHost>
以下是Apache Tomcat的连接器配置:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/root/.keystore"
keystorePass="password" />