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