WS协议和Apache的mod_proxy_wstunnelconfiguration:错误500

当试图通过我的Apache2服务器访问ws:// localhost:8080时,出现错误500。 该服务器运行OpenSuse Leap 42.1和Apache 2.4.16。

这些Apache2模块已启用:mod_proxy,mod_proxy_http,mod_proxy_wstunnel。

当从本地networking调用请求时,一切工作正常。 URL示例: http://<myhost-ip-address>/api/ws/<some-url> 。 它返回状态101和响应: Upgrade: websocket 。 没关系。

来自外部networking的同一种请求失败。 url示例: ws://www.mysite.com/api/ws/<some-url> 。 它返回错误500。

Apache访问日志包含: GET /api/ws/<some-url> HTTP/1.1" 500 ...

Apache错误日志包含: [proxy:warn] AH01144: No protocol handler was valid for the URL /api/ws/<some-url>. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. [proxy:warn] AH01144: No protocol handler was valid for the URL /api/ws/<some-url>. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

我的httpd.conf:

 <VirtualHost *:80> ServerName mysite.com ServerAlias mysite.com # Redirection for ws protocol ProxyPreserveHost On ProxyVia full ProxyRequests OffHere RewriteEngine On RewriteCond %{REQUEST_URI} ^/api/ws/(.*) [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:8080/$1 [P,L] # Proxy pass ProxyPass /api/ws/ ws://localhost:8080/api/ws/ ProxyPassReverse /api/ws/ ws://localhost:8080/api/ws/ # DocumentRoot DocumentRoot /srv/www/vhosts/mysite.com <Directory "/srv/www/vhosts/mysite.com"> Options Indexes SymLinksIfOwnerMatch AllowOverride None ... </Directory> # URL as parameter AllowEncodedSlashes NoDecode 

我遵循这些以前的答案(感谢): websockets , node.js , socket-io ,但没有运气。

在我的configuration中一定是错的。 有任何想法吗?

看起来像缺lessWebsockets支持所需的mod_proxy_wstunnel模块。

它应该像下面的httpd.conf中启用

 LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so 

安装模块,然后它应该工作正常。