Ionic3(Angular4)CORS在仿真器上 [英] Ionic3(Angular4) CORS on an emulator
问题描述
我正在genymotion模拟器上测试Ionic 3应用程序。
因为CORS,Btw http请求不起作用。
我以为服务器有问题。
但我确认服务器在使用ionic 2 app检查后没有问题。
Ionic 3应用程序的Http请求在真实设备和浏览器上运行良好。
你想让我知道我错了吗?
抱歉我的英语不好。
I'm testing Ionic 3 app on a genymotion emulator. Btw http request doesn't work because of CORS. I thought that a sever has a problem. But I confirmed that a server has no problem after checking it with ionic 2 app. Http request of Ionic 3 app works well on a real device and on a browser. Would you like to let me know what I am wrong? sorry for my poor english.
谢谢
推荐答案
在你的config.xml下给出你本地主机的位置
under your config.xml give the location of your localhost
例如:
<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下添加代理网址
further more make sure you add the proxy url under ionic.config.json
"proxies": [{
"path": "/rest",
"proxyUrl": "http://10.10.10.1:8081/rest"
}]
这篇关于Ionic3(Angular4)CORS在仿真器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!