vue cli代理运行在mac平台偶尔请求失败问题
1.问题
Proxy error: Could not proxy request /chart/update from xxx.xx.xx.xx:xxxx to http://xxx.xx.xx.xx:xxxx.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
2.解决
vue.config.js
:
const http = require('http')
devServer: {
proxy: {
'/': {
target: 'http://xxx.xx.xx.xx:xxxx,
changeOrigin: true,
ws: false,
// 解决mac 代理失败问题
headers: {
Connection: 'keep-alive'
},
agent: new http.Agent()
}
}
},