Apache 反向代理 Mattermost (websocket)

问题描述 投票:0回答:1

我遇到了 Mattermost 代理配置问题。 我的环境: 服务器 A - Web 服务器、代理和 Internet 网关(运行 Apache2) 服务器 B - Mattermost 服务器(IP:192.168.100.15)

错误:“请检查您的连接,Mattermost 不可用。如果问题不可用,请要求管理员启用 Websocket 端口。”

Apache2日志:

[Thu Jul 25 14:03:53.339846 2024] [proxy:error] [pid 96487] [client 79.187.92.58:56685] AH00898: Error during SSL Handshake with remote server returned by /api/v4/websocket
[Thu Jul 25 14:03:54.282932 2024] [proxy:error] [pid 94790] (20014)Internal error (specific information not available): [client 79.187.92.58:57806] AH01084: pass request body failed to 192.
168.100.15:443 (192.168.100.15)
[Thu Jul 25 14:03:54.282986 2024] [proxy:error] [pid 94790] [client 79.187.92.58:57806] AH00898: Error during SSL Handshake with remote server returned by /api/v4/websocket
[Thu Jul 25 14:03:55.219146 2024] [proxy:error] [pid 94787] (20014)Internal error (specific information not available): [client 79.187.92.58:55088] AH01084: pass request body failed to 192.
168.100.15:443 (192.168.100.15)
[Thu Jul 25 14:03:55.219175 2024] [proxy:error] [pid 94787] [client 79.187.92.58:55088] AH00898: Error during SSL Handshake with remote server returned by /api/v4/websocket

主机文件:

<VirtualHost *:80>
    ServerName teamchat.domain.xyz
    Redirect permanent / https://teamchat.domain.xyz
</VirtualHost>


<VirtualHost *:443>
    ServerName teamchat.domain.xyz

    SSLEngine on
    SSLProxyEngine On
    SSLCertificateFile /var/www/html/domain/ssl/domain.xyz.crt
    SSLCertificateKeyFile /var/www/html/domain/ssl/domain.xyz.key
    # SSLCertificateChainFile /var/www/html/domain/ssl/domain.xyz.bundle

    ErrorLog /var/log/apache2/mattermost-error.log
    CustomLog /var/log/apache2/mattermost-access.log combined

    ProxyPreserveHost On
    ProxyRequests Off

    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 .* wss://192.168.100.15:443%{REQUEST_URI} [P,QSA,L]

    <LocationMatch "^/api/v(?<apiversion>[0-9]+)/(?<apiusers>users/)?websocket$">
        Require all granted
        ProxyPass wss://192.168.100.15:443/api/v%{env:MATCH_APIVERSION}/%{env:MATCH_APIUSERS}websocket
        ProxyPassReverse wss://192.168.100.15:443/api/v%{env:MATCH_APIVERSION}/%{env:MATCH_APIUSERS}websocket
        ProxyPassReverseCookieDomain 192.168.100.15 teamchat.domain.xyz
    </LocationMatch>

    <Location />
        Require all granted
        ProxyPass https://192.168.100.15/
        ProxyPassReverse https://192.168.100.15/
        ProxyPassReverseCookieDomain 192.168.100.15 teamchat.domain.xyz
    </Location>
</VirtualHost>

我可以通过更改 Windows 中的主机文件来连接到本地网络上的 Mattermost: 192.168.100.15 teamchat.domain.xyz 而且效果很好。

我对 Apache 的熟练程度不够,无法弄清楚我还能做什么。

版本: 服务器版本:Apache/2.4.38(Debian) 服务器建成时间:2023-04-21T22:01:00

最重要的版本: 版本:7.4.0 内部版本号:7.4.0 构建日期:UTC 2022 年 10 月 12 日星期三 19:37:03 构建哈希:8cb6718a9bcc45186f62baed2304248d3cabaa50 构建企业就绪:正确

apache2 reverse-proxy mattermost
1个回答
0
投票

请检查您的系统控制台 > 集成 > CORS 设置。

这对我有用。如下图所示。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.