Hi There,
i am building ios and android app on ionic2 .RC2
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.4
Ionic App Lib Version: 2.1.2
Ionic App Scripts Version: 0.0.39
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: Mac OS X Sierra
Node Version: v7.0.0
Xcode version: Xcode 8.1 Build version 8B62
however i have an issue with ios api request, it’s sends the origin=null value this causes a CORS issue
Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
Failed to load resource: Preflight response is not successful
XMLHttpRequest cannot load ‘API URL’. Preflight response is not successful
i dont have access on backend api’s however the android build it sends the origin=file:// which in this case i dont have any issue. i will post the config.xml settings and request header for both device below
IOS REQUEST
OPTIONS http://10.10.1.152/DesktopModules/FYAuthentication/API/UserHandler/Login HTTP/1.1
Host: 10.10.1.152
Origin: null
Access-Control-Request-Method: POST
Connection: keep-alive
Access-Control-Request-Headers: content-type, origin, loginattempt
Connection: keep-alive
Accept: /
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Mobile/14A403
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Content-Length: 0
ANDROID REQUEST
POST http://10.10.1.152/DesktopModules/FYAuthentication/API/UserHandler/Login HTTP/1.1
Host: 10.10.1.152
Connection: keep-alive
Content-Length: 76
Origin: file://
loginattempt: 1
User-Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/54.0.2840.85 Mobile Safari/537.36
content-type: application/json
Accept: /
Accept-Encoding: gzip, deflate
Accept-Language: en-US
X-Requested-With: com.di.testapp
{
“username”: “”,
“password”: “”,
“culture”: “en”
}
CONFIG.XML
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="tel:*" />
<allow-navigation href="mailto:*" />
<allow-navigation href="http://10.10.1.152" />
<allow-navigation href="https://test.ctpe.net" />
<allow-navigation href="https://ctpe.net" />
INDEX.HTML
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-eval' 'unsafe-inline'; img-src 'self' data:;">
Your help is much appreciated