web/vite.config.ts
@@ -10,13 +10,14 @@ } }, server: { port: 5173, port: 3000, open: true, proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '/api') // 不需要重写路径,因为后端的context-path就是/api // rewrite: (path) => path.replace(/^\/api/, '/api') } } },