fix(web): preserve nginx subpath prefix for api/runtime config#226
Open
fix(web): preserve nginx subpath prefix for api/runtime config#226
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
修复 SkillHub 在 Nginx 子路径反向代理(如
/skill_hub)下 API 前缀失效与 runtime-config 加载路径错误的问题。变更内容
后端实现
前端实现
new URL('/path', baseUrl)覆盖baseUrl子路径前缀。withBaseUrl与buildApiUrl统一改为前缀保留拼接逻辑(prependApiBaseUrl)。bootstrap中 runtime 配置脚本改为基于import.meta.url解析,支持子路径部署下加载runtime-config.js。apiBaseUrl为https://api.example.com/skill_hubapiBaseUrl为/skill_hubfetchText请求路径前缀拼接测试覆盖
cd web && pnpm vitest run src/api/client.test.tsmake test-frontend(172 files, 512 tests)cd web && pnpm test:e2e(33 passed)web/test-results/质量门禁
make typecheck-web通过(0 errors)make lint-web通过(0 errors, 0 warnings)make test-frontend通过make test-backend-app通过(如有后端变更)web/e2e)关键路径通过(如有 UI 交互变更)make generate-api已执行且schema.d.ts已提交(如有 Controller 变更)安全考虑
本次变更不涉及安全敏感内容。
相关 Issue
Closes #223
测试说明
本地验证步骤
SKILLHUB_WEB_API_BASE_URL=/skill_hub。https://<host>/skill_hub/)。/skill_hub/api/...且可正常返回。回归测试范围
withBaseUrl、buildApiUrl)bootstrap)截图/录屏(如有 UI 变更)
无 UI 视觉变更;E2E 产物见
web/test-results/。