Add HTTPS demo entry for microphone access

- Add a self-signed HTTPS Nginx entrypoint on Docker port 4443 so browser microphone APIs can run in demo mode.

- Keep the existing HTTP port 4002 unchanged while exposing container port 443 and generating the demo certificate during image build.

- Update CORS defaults and Compose environment for the HTTPS frontend origin.

- Clarify the report editor microphone message with localhost, HTTPS, and browser trusted-origin demo options.

- Document the browser HTTP microphone limitation, HTTPS demo URL, and Chrome/Edge insecure-origin workaround in README and docs.
This commit is contained in:
2026-05-02 03:34:31 +08:00
parent 2a86d9f5e4
commit b346b7e194
12 changed files with 81 additions and 11 deletions

View File

@@ -74,11 +74,11 @@ AI 和语音密钥由后端 Settings API 保存并由代理使用,前端不再
docker-compose up -d --build
```
默认通过 Nginx 暴露 `http://localhost:4002`
默认通过 Nginx 暴露 `http://localhost:4002`,并额外暴露自签名证书的语音演示入口 `https://localhost:4443`
当前 Compose 服务:
- `web`:前端静态站点,暴露 `http://localhost:4002`
- `web`:前端静态站点,暴露 `http://localhost:4002``https://localhost:4443`
- `api`NestJS API暴露 `http://localhost:3002`
- `db`PostgreSQL 16暴露 `localhost:5433`
- `uploads_data`:后端文件持久化 volume。
@@ -88,7 +88,23 @@ docker-compose up -d --build
- `Dockerfile` 使用 Node 构建 `dist/`
- 运行阶段使用 `nginx:alpine` 托管静态文件。
- `Dockerfile.server` 构建并运行 NestJS API。
- `nginx.conf` 已配置 SPA 路由回退、`/api` 反向代理`100m` 请求体上限。
- `nginx.conf` 已配置 SPA 路由回退、`/api` 反向代理`100m` 请求体上限和自签名 HTTPS 演示入口
## 麦克风访问
浏览器不允许普通局域网 HTTP 页面调用麦克风代码无法绕过这个限制。Docker 演示环境建议使用:
```text
https://localhost:4443
```
首次打开会看到自签名证书提示,接受后即可让浏览器开放麦克风权限。如果必须用 `http://局域网IP:4002` 演示,只能在 Chrome/Edge 启动时加临时参数,把该 HTTP 来源标记为可信:
```bash
google-chrome --unsafely-treat-insecure-origin-as-secure=http://局域网IP:4002 --user-data-dir=/tmp/surclaw-chrome-demo
```
这是浏览器演示开关,不是系统安全方案;正式环境仍建议使用 HTTPS。
## 部署边界