fix(dev-server): proxy /auth to txw-cloud gateway

阶段 1 收尾 BUG-C:auth-refactor.js 调 /auth/loginByPassword
(txw-cloud 新栈),vue.config.js 的 devServer.proxy 缺 ^/auth 条目,
dev server 不知把请求转给 8080 gateway,请求落到 SPA fallback
返回 index.html,登录永远走不通。

target 指向 http://localhost:8080(与 .env.development.new
中 VUE_APP_MHZC_PROXY 一致,8080 是新 gateway,auth 9200 /
system 9201 都在它后面)。

不破坏 9002 老栈:^/sso / ^/mhzc / ^/gxzx / ^/yygl 保持原状。

验收:点登录按钮 → localStorage 自动出现 txw_access_token →
/system/user/getInfo 请求头带 Authorization: Bearer ...
This commit is contained in:
liulong 2026-06-07 13:48:22 +08:00
parent b266f36ce2
commit 3189873e54

View File

@ -288,6 +288,12 @@ module.exports = {
// Vue CLI prepareProxy 用 pathname.match(代理键) 判断;键写 '/mhzc' 会变成匹配路径里任意位置的 /mhzc
// 会误伤 SPA 路由 /view/mhzc/...,刷新时整页请求被转发到后端导致 Proxy error。必须用 ^ 限定为路径前缀。
proxy: {
// 阶段 1 收尾 BUG-Cauth-refactor.js 调 /auth/loginByPasswordtxw-cloud 新栈)。
// 8080 是新 gatewayauth 9200 / system 9201 都在它后面),不配这条会落到 SPA fallback。
'^/auth': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'^/sso': {
// target: 'http://localhost:9300',
// target: 'http://carbon.liantu.tech',