模拟器上的 Ionic3(Angular4) CORS
Ionic3(Angular4) CORS on an emulator
我正在 genymotion 模拟器上测试 Ionic 3 应用程序。
顺便说一句,由于 CORS,http 请求不起作用。
我以为服务器有问题。
但是我用ionic 2 app检查后确认服务器没有问题。
Ionic 3 应用程序的 Http 请求在真实设备和浏览器上运行良好。
你想让我知道我错了吗?
抱歉我的英语不好。
谢谢
在您的 config.xml 下给出您本地主机的位置
例如:
<content src="http://10.10.1.1:8100" />
<access origin="http://10.10.1.1:8100" />
<allow-navigation href="http://10.10.1.1:8100" />
进一步确保在 ionic.config.json
下添加代理 url
"proxies": [{
"path": "/rest",
"proxyUrl": "http://10.10.10.1:8081/rest"
}]
我正在 genymotion 模拟器上测试 Ionic 3 应用程序。 顺便说一句,由于 CORS,http 请求不起作用。 我以为服务器有问题。 但是我用ionic 2 app检查后确认服务器没有问题。 Ionic 3 应用程序的 Http 请求在真实设备和浏览器上运行良好。 你想让我知道我错了吗? 抱歉我的英语不好。
谢谢
在您的 config.xml 下给出您本地主机的位置
例如:
<content src="http://10.10.1.1:8100" />
<access origin="http://10.10.1.1:8100" />
<allow-navigation href="http://10.10.1.1:8100" />
进一步确保在 ionic.config.json
下添加代理 url"proxies": [{
"path": "/rest",
"proxyUrl": "http://10.10.10.1:8081/rest"
}]