cordova - CORS issues when emulating ionic app on iOS -
i updated ionic-cli
, trying emulate ionic app command ionic cordova emulate ios
.
however, getting cors errors every api requests
origin http://localhost:8080 not allowed access-control-allow-origin.
i found ionic docs above command
like running cordova emulate directly, watches changes in web assets , provides live-reload functionality --livereload option.
it seems command starts server, explain why origin localhost
instead of file://
.
however, tried emulating cordova emulate ios
, or building app ionic cordova build ios
, running output simulator, still cors errors.
emulating on android works fine , there proxy running app in browser.
any idea if on right track , if there way emulate file://
? problem persists when releasing app app store?
try creating ionic proxy, adding code ionic.config.json
"proxies": [{ "path": "/api", "proxyurl": "http://your-server.com" }]
and call server http.get('/api')
if still not working, try using cordova http plugin instead of angular http.
Comments
Post a Comment