vue本地项目,有时服务器端会执行很耗时的操作,但前台在发起请求2分钟左右,会自动断掉,报错:
net::ERR_EMPTY_RESPONSE
配置proxy的超时,在devServer中设置proxy:
devServer: {
host: "0.0.0.0",
port: 8888, // 端口
open: false, // 启动后打开浏览器
overlay: {
warnings: false,
errors: true,
},
proxy: {
//配置跨域
"/api": {
target: defaultSettings.baseUrl,
changOrigin: true,
pathRewrite: { "^/api": "" },
timeout: 3600000, //===========在这里设置接口超时=============
},
},
},