首页 > 解决方案 > 为什么我在 WebRTC 会议中收到 Websocket 错误?

问题描述

我正在尝试 AntMedia EE 试用版

我正在使用位于 https://ant.techrova.in/LiveApp/conference.html的 WebRTC 演示

(内置演示)

加入房间被禁用,我检查控制台

在此处输入图像描述

我收到这些错误

WebSocket 连接到“wss://ant.techrova.in/LiveApp/websocket”失败:WebSocket 握手期间出错:意外响应代码:404

不知道如何解决?

这是我的 apache 代理配置

对于 http

<VirtualHost *:80>
        ServerName ant.techrova.in
        ProxyPreserveHost On

        ProxyPass / http://127.0.0.1:5080/
        ProxyPassReverse / http://127.0.0.1:5080/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =ant.techrova.in
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]


</VirtualHost>

对于 https

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName ant.techrova.in
        ProxyPreserveHost On

        ProxyPass / http://127.0.0.1:5080/
        ProxyPassReverse / http://127.0.0.1:5080/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined



SSLCertificateFile /etc/letsencrypt/live/ant.techrova.in/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ant.techrova.in/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

=====================

请帮助解决此问题

标签: socketshttpswebsocketwebrtcant-media-server

解决方案


请启用以下模块:

a2enmod proxy proxy_http proxy_wstunnel

在您的 conf 文件中添加以下行。

RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*)           ws://localhost:5080/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*)           http://localhost:5080/$1 [P,L]
ProxyPass / http://localhost:5080/
ProxyPassReverse / http://localhost:5080/

之后重新启动 apache2 服务,如下所示:

systemctl restart apache2

推荐阅读