peng
2025-11-06 c4938f6f4e839890b032c75c7a57333a6a9157a9
web/vite.config.ts
@@ -10,14 +10,16 @@
    }
  },
  server: {
    host: '0.0.0.0',
    port: 3000,
    open: true,
    proxy: {
      '/api': {
        target: 'http://localhost:8080',
        // 将API代理回本地后端,便于完整联调(后端运行在 http://127.0.0.1:8080/api)
        target: 'http://127.0.0.1:8080',
        changeOrigin: true,
        // 不需要重写路径,因为后端的context-path就是/api
        // rewrite: (path) => path.replace(/^\/api/, '/api')
        secure: false,
        // 不需要重写路径,因为后端的context-path就是 /api
      }
    }
  },