module.exports = { devServer: { proxy: { '/api': { // 你的目标服务器的请求路径前缀 target: 'https://hwjb.homilychart.com', // 目标服务器的地址 changeOrigin: true, // 是否跨域 secure: false, // 如果是https接口,需要配置这个参数 pathRewrite: { '^/': '/testApi' // 将 /api 替换为 /testApi,以便正确请求目标服务器的资源 } } } } }