本地设置 manifest.json
"h5": {
"devServer": {
"https": false,
"port": 80,
"proxy": {
"/lxapi": {
"target": "https://B.yuming.cn",
"changeOrigin": true,
"secure": false,
"pathRewrite": {
"^/lxapi": ""
}
}
}
}
}
uni.request({ url: '/lxapi/api/Query',
例 API 地址:https://B.yuming.cn/api/Query
本地运行测试没有问题,但是发布后请求不到,是什么问题?
浏览器 Network 有个 https://A.yuming.cn/lxapi/api/Query 404 求助~!
还有个警告
A cookie associated with a cross-site resource at http://dcloud.io/ was set without the SameSite
attribute.
5***@qq.com
如何解决
2020-03-19 08:17
4***@qq.com (作者)
回复 5***@qq.com: 这个配置只是本地测试跨域API的问题,其实问题不在Uniapp,只要将WebAPI 服务端允许跨域就行就可以了
2020-03-19 08:59