uniapp的h5配置反向代理
uniapp写的h5配置反向代理,首先要把开发环境的环境变量置为空
然后再mainifest.json中进行配置要代理的接口以及目标地址,示例如下
"devServer" : {
"disableHostCheck" : true,
"proxy" : {
"/platform" : {
"target" : "http://baidu.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/platform" : "/platform"
}
},
"/user" : {
"target" : "http://baidu.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/user" : "/user"
}
}
},
"https" : false
},