修复Vite代理配置,解决前后端通信问题
1. 修复后端API代理配置 - 更新代理目标端口从82改为8123(匹配实际后端端口) - 区分BladeX系统模块和业务模块的URL路径处理 2. 解决验证码接口404问题 - 新增 ^/api/blade- 规则处理系统模块(blade-auth、blade-system等) - 系统模块需去掉 /api 前缀转发到后端 /blade-auth/* 路径 - 业务模块保留 /api 前缀转发到后端 /api/martial/* 路径 3. 验证测试结果 - ✅ /api/blade-auth/oauth/captcha 验证码接口正常 - ✅ /api/blade-system/tenant/info 租户信息接口正常 - ✅ /api/martial/competition/list 比赛列表接口正常 现在前端登录页面可以正常获取验证码,所有API接口都能正确访问。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,14 +16,17 @@ export default ({ mode, command }) => {
|
||||
server: {
|
||||
port: 2888,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:82',
|
||||
// target: 'http://120.197.149.12:8480',
|
||||
// target: 'https://2df1-223-74-180-188.ngrok-free.app ',
|
||||
//target: 'https://saber3.bladex.cn/api',
|
||||
// BladeX 系统模块 (blade-auth, blade-system等) 需要去掉 /api 前缀
|
||||
'^/api/blade-': {
|
||||
target: 'http://localhost:8123',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/api/, ''),
|
||||
},
|
||||
// 武术业务模块保留 /api 前缀
|
||||
'/api': {
|
||||
target: 'http://localhost:8123',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
|
||||
Reference in New Issue
Block a user