vue-cli使用proxy代理


module.exports = {
publicPath: '/', //项目的公共路径
devServer: { //开发用的服务器配置
proxy: {
'/api': {
target: 'http://localhost:8091', //这里是目标服务器地址
changeOrigin: true, //是否改变源地址
ws: true, //是否支持websocket协议
pathRewrite: { //路径重写
'^/api': '' //这里一定要为空
}
}
}
}
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM