![使用 apache 作为代理时,Mattermost Websocket 握手失败](https://linux22.com/image/187219/%E4%BD%BF%E7%94%A8%20apache%20%E4%BD%9C%E4%B8%BA%E4%BB%A3%E7%90%86%E6%97%B6%EF%BC%8CMattermost%20Websocket%20%E6%8F%A1%E6%89%8B%E5%A4%B1%E8%B4%A5.png)
我的服务器上的 Mattermost 安装没有取得任何进展。我已经安装了一切,没有任何问题。
之后,我启用了 apache modproxy_wstunnel
并在我的 Plesk 域中添加了以下指令以获取其他指令(如<VirtualHost *:80>
或<VirtualHost *:443>
):
HTTP:
ErrorLog ${APACHE_LOG_DIR}/mattermost-error.log
CustomLog ${APACHE_LOG_DIR}/mattermost-access.log combined
# Enforce HTTPS:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
HTTPS:
ServerName mattermost.xxx.de
ProxyPreserveHost On
# Set web sockets
ProxyRequests Off
RemoteIPHeader CF-Connecting-IP
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/api/v[0-9]+/(users/)?websocket [NC,OR]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
RequestHeader set X-Forwarded-Proto "https"
<LocationMatch "^/api/v(?<apiversion>[0-9]+)/(?<apiusers>users/)?websocket">
Require all granted
ProxyPass ws://127.0.0.1:8065/api/v%{env:MATCH_APIVERSION}/%{env:MATCH_APIUSERS}websocket
ProxyPassReverse ws://127.0.0.1:8065/api/v%{env:MATCH_APIVERSION}/%{env:MATCH_APIUSERS}websocket
ProxyPassReverseCookieDomain 127.0.0.1 mattermost.xxx.de
</LocationMatch>
<Location />
Require all granted
ProxyPass http://127.0.0.1:8065/
ProxyPassReverse http://127.0.0.1:8065/
ProxyPassReverseCookieDomain 127.0.0.1 mattermost.xxx.de
</Location>
但是当我保存它,重新启动 apache 并返回到 Mattermost 时,我仍然收到 Websocket 错误:
在网络选项卡中,响应为空......