title: vue设置代理(proxy)
tag:
- proxy
- 代理
- vue设置代理(proxy)
vue设置代理(proxy)
devServer: {
port: port,
proxy: {
'/rng': { //这里最好有一个 /
target: 'https://github.com/login/oauth/access_token', // 后台接口域名
ws: true, //如果要代理 websockets,配置这个参数
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, //是否跨域
pathRewrite: {
'^/rng': ''
}
}
},
},
容易出错的地方
rng貌似长度过长,参杂大小写,都会导致代理失败。
本文详细介绍了在Vue开发环境中如何设置代理(proxy)以解决跨域问题,重点探讨了设置过程中可能遇到的错误及解决方案,确保正确配置以实现API请求的顺利进行。
917

被折叠的 条评论
为什么被折叠?



