feat: 前端配置代理解决上传跨域问题

- 配置 Vite 开发服务器代理 /api 和 /uploads 到后端
- API baseURL 改为相对路径 '/api'
- 修改上传 action 为相对路径 '/api/upload/image'
- 移除后端 FileUploadController 的 @CrossOrigin 注解
- 恢复 WebMvcConfig 的拦截器配置
This commit is contained in:
wangziqi
2026-02-10 16:06:53 +08:00
parent 1233d86230
commit b1a153298f
7 changed files with 17 additions and 5 deletions

View File

@@ -4,6 +4,18 @@ import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
server: {
port: 5173
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false
},
'/uploads': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false
}
}
}
})