其他分享
首页 > 其他分享> > Vuecli本地项目,设置超时

Vuecli本地项目,设置超时

作者:互联网

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,   //设置接口超时
      },
    },
},

标签:Vuecli,false,0.0,api,proxy,本地,超时,true
来源: https://blog.csdn.net/eclothy/article/details/121498363