When developing locally using ionic serveor ionic run/emulate -l -cwith the restart function enabled, Ionic creates a local dev server on port 8100 ( http://localhost:8100/) by default . originin this case localhost:8100, which, when you communicate with an external service via HTTP with CORS enabled, consider that the request is not trustworthy and therefore rejects it.
Ionic (http://blog.ionic.io/handling-cors-issues-in-ionic/), Ionic API , , origin, Ionic 1, Ionic v2.
Ionic v2
ionic.config.json proxies.
{
"name": "project-name",
"app_id": "xyz-projectid",
"v2": true,
"typescript": true,
"proxies": [{
"path": "/api",
"proxyUrl": "https://the-real-api-host.com"
}]
}
/api, https://the-real-api-host.com.
api, http://my-custom-api.com/api/v2/, proxyUrl.
API
URL- API https://the-real-api-host.com /api. /api , Ionic .
. API, , / CORS.