yeg
2026-09-14 2e8cbe6ad33c636a21456ab8876ede5e8623b0b8
fix(config): 跨域允许来源补上后台管理端的本机地址

后台管理端跑在 http://localhost:5273,但允许来源里只有换网前的
http://192.168.110.15:5273,预检被判跨域直接返回 403,后台登录后所有请求都失败。

补齐 localhost/127.0.0.1 与本机当前局域网 IP 的 5273,并去掉已不存在的 .15。
1个文件已修改
5 ■■■■■ 已修改文件
talent-card-server/src/main/resources/application.yml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
talent-card-server/src/main/resources/application.yml
@@ -39,8 +39,9 @@
app:
  cors:
    # HBuilderX Web development origins; override with exact deployed frontend origins.
    allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:7893,http://localhost:7894,http://127.0.0.1:7893,http://127.0.0.1:7894,http://192.168.110.26:5173,http://192.168.110.15:5273}
    # 后台管理端(vite dev,默认 5273)与 HBuilderX Web 调试来源;部署时用 CORS_ALLOWED_ORIGINS 覆盖为真实域名。
    # localhost 与局域网地址都要列:换网段后局域网 IP 会变,localhost 是最稳的调试入口。
    allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:5273,http://127.0.0.1:5273,http://localhost:7893,http://localhost:7894,http://127.0.0.1:7893,http://127.0.0.1:7894,http://192.168.110.26:5273,http://192.168.110.26:5173}
  privacy:
    # Production must provide APP_PRIVACY_ENCRYPTION_KEY through the deployment secret store.
    encryption-key: ${APP_PRIVACY_ENCRYPTION_KEY:talent-card-local-development-key}