HttpClient cors on device?

Hi there, I confused for getting error on login. I try create HttpClient login. I’ve got error and response {"isTrusted":true}. I think that is cause cors. what should I do for solving this problem.
this my code:

      var head = new Headers();
       head.append('Content-Type', 'application/json');
       head.append('comp-id', data.compID);
       head.append('x-access-token', mytoken);
       this.http.testPost(url + 'user/authentication', this.userData).subscribe(
        data => {
          this.navCtrl.setRoot(HomePage, {}, { animate: true, direction: 'forward' });
      error => {
        var e = error.json();
        this.alert.presentAlert('Login failed', JSON.stringify(e)).present();


this for browser, write in ionic.project.json and restart serve:

  "name": "proxy-example",
  "app_id": "",
  "proxies": [
      "path": "/api",
      "proxyUrl": ""

add this line on config.xml:

<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />

once you add the code above, please remove all platform or run this CLI:

ionic cordova platform rm ios
ionic cordova platform rm android
ionic cordova platform add ios
ionic cordova platform add android

remove platforms and add

1 Like