vue cli3.x
使⽤⽅式:
1、直接简单配置
郑筱萸
在fig.js加⼊
devServer: {
proxy: 'localhost:8080'
crh2}
前端直接axios 调⽤⽅式:
2、/API ⽅式代理
lintOnSave: false,
// 修改的配置冰冻切片
// cli3 代理是从指定的target后⾯开始匹配的,不是任意位置;配置pathRewrite可以做替换
devServer: {
proxy: {北京9天增205例
'/API': {
//你要跨域的域名(包含host、端⼝号,切记:⼀定要带上http头); target: 'localhost:8080',
ws: true,
changeOrigin: true, //是否跨域,设置为true;(必须)
pathRewrite: {
// 这⾥会把当前域名下路径/FreightTransport开头的地⽅替换为127.0.0.1:8099/API【这样就可以和服务器nginx保持⼀致的路径】"^/API": "/API", // 设置/API路径重定向为根⽬录"/API"; }
}
安徽省委员会}
},
生态健康
}