代理设置

在 NGINX 或 Apache2 等代理后运行 OpenReplay 的设置。

代理设置

使用反向代理将 OpenReplay 与其他应用程序一起托管

Section titled 使用反向代理将 OpenReplay 与其他应用程序一起托管

当 OpenReplay 在某台机器上运行时,它会使用 80/443 端口来对外提供应用程序。但当你使用反向代理时,可以将 OpenReplay 配置为使用其他端口来访问应用程序。以下是具体操作步骤:

  1. 编辑配置文件:
openreplay -e
  1. 修改 nginx 配置部分:
ingress-nginx: &ingress-nginx
  controller:
	...
	...
    service:
      externalTrafficPolicy: "Local"
      ports:
        http: 880   # Change this port for http
        https: 8443 # Change this port for https
  1. 使用 :wq 保存并退出配置,以便 OpenReplay 重新加载配置。

随后即可配置你的反向代理。请参考以下各节进行配置。

确保你的代理正在发送 X-Forwarded-ForX-Forwarded-Proto 标头。还必须启用 SSL,OpenReplay 才能正常工作。其余配置应如下所示:

location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://1.2.3.4:880; # replace with OpenReplay instance IP
    }

确保已启用 proxyproxy_httpproxy_html 模块。同样必须配置 SSL,其余设置应与以下内容类似:

<VirtualHost *:443>
    ProxyPass / http://1.2.3.4:880 <!-- replace with instance IP -->
    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
    # SSL + other config here
</VirtualHost>

如果你使用代理保护 OpenReplay 实例,请确保以下端点可公开访问,以便 OpenReplay 正常工作。

端点说明
/ingest用于捕获事件和录制
/api用于拉取和管理用户数据
/assist用于与最终用户进行实时视频/通话(WebRTC)
/ws-assist用于与最终用户进行实时会话回放
/static/openreplay.js加载 OpenReplay 的 JavaScript 代码

如果你对此过程有任何疑问,欢迎通过我们的 Slack 联系我们,或访问我们的论坛