Vue-cli 4.5.13 跨域配置
按照路径找到
项目/config/index.js
文件,在dev
下的proxyTable
中进行配置
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
// ==================
// 这里配置
proxyTable: {
'/api': {
target: 'http://XXXX:YYY/',
ws: true,
changOrigin: true,
pathRewrite: {
'^/api': ''
},
// logLevel: 'debug'
}
// =================
},
.......
},
......
}