Skip to content

fix: serve embed entry for Lite routes - #2672

Open
ttommybot wants to merge 1 commit into
Tencent:mainfrom
ttommybot:fix/lite-embed-static-route
Open

fix: serve embed entry for Lite routes#2672
ttommybot wants to merge 1 commit into
Tencent:mainfrom
ttommybot:fix/lite-embed-static-route

Conversation

@ttommybot

Copy link
Copy Markdown
Contributor

Description

修复 Lite 部署中 Embed 页面静态路由回退错误的问题。

管理页生成的 Embed 地址使用 /embed/{channelId}。标准部署的 Nginx 会将该路径正确回退到独立的 embed.html,但 Lite 的 Go 静态文件服务此前会统一回退到主站 index.html,导致 Embed 地址加载管理后台入口,而不是 Embed 应用。

本次修改:

  • Lite 模式下将不存在的 /embed/* 路径回退到 embed.html
  • 保持普通前端路由继续回退到 index.html
  • 保持已有静态文件的直接访问逻辑不变。
  • 当构建产物缺少 embed.html 时返回 404,并记录警告,避免错误地返回管理后台页面。
  • 补充 GET、HEAD、普通 SPA 回退及缺少 Embed 入口等回归测试。

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

N/A

Testing

已完成以下验证:

  • git diff --check 通过。
  • 在 Podman Linux 环境的 golang:1.26-bookworm 镜像中运行聚焦测试:
    • go test internal/router/static.go internal/router/router_static_test.go -count=1
    • 测试通过。
  • 尝试运行完整的 go test ./internal/router -count=1 -p=1,但下载 github.com/pierrec/lz4/v4github.com/go-ego/gse 间接依赖时网络连接被重置,因此完整包测试未能完成;失败发生在依赖下载阶段,不是编译或测试断言失败。

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable (for Go: golangci-lint run --new-from-rev=origin/main ./...)
  • Full-repository checks were run, or any unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation (README, docs/, Swagger annotations, etc.)
  • Breaking changes are clearly called out in the description above

Screenshots / Recordings

N/A — no user-visible UI changes

sakitam-fdd added a commit to sakitam-fdd/WeKnora that referenced this pull request Aug 21, 2026
Port Tencent#2672 onto the current fork staging branch using GitHub's three-way merge.
sakitam-fdd added a commit to sakitam-fdd/WeKnora that referenced this pull request Aug 21, 2026
Port Tencent#2672 after current-main three-way validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant