module.exports = {
devServer:{
// proxy:"http://localhost:3000"
proxy:{
'/api':{
changeOrigin:true, //设是否置改变host的地址,这样就可以跨域了
target:'http://localhost:3000', //设置代理的服务器地址以及端口号
pathRewrite:{ //路径重定向,表示的是如果接口中是以''开头的,那么会重定向到http://localhost:3000
'^/api':''
}
},
'/mm':{
changeOrigin:true,
target:'http://mobile.bwstudent.com',
pathRewrite:{
'^/mm':''
}
}
},
// publicPath:'/'
}
};
vue项目的反向代理的配置
最新推荐文章于 2024-05-08 18:02:20 发布