UNI-APP如何测试本机hosts重定向的接口呢,
我前端后端都在本地,本地PHP开发的接口,hosts里虚拟了一个域名,uni-app用谷歌浏览器测试uni.request调用虚拟的域名一直不通,按照网上方法,H5调试配置也设置了 ,一直不成功,请大神们指点。
"h5" : {
"router" : {
"mode" : "history"
},
"devServer":{
"port" : 8070,
"https" : false,
"disableHostCheck": true
},
"proxy": {
"/zxy": {
"target":"http://zhengxuyong.com",
"changeOrigin": true,//是否跨域
"secure": false // 设置支持https协议的代理
,"pathRewrite":{"^/zxy":"/"}
}
}
}
- Request URL: http://zhengxuyong.com/zxy/user/login
Referrer Policy: strict-origin-when-cross-origin
Accept: /
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Content-Length: 49
content-type: application/x-www-form-urlencoded;application/json
Host: zhengxuyong.com
Origin: http://localhost:8070
Referer: http://localhost:8070/
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1
1 个回复
2***@qq.com (作者)
这就是传说中的跨域问题吧!