title: ionic framework error - Response with status: 0 for URL: null
body: <p>I am working on ionic app. On Server side there is CodeIgniter. There is CORS issue because of which the login is not working. 
  In browser it works fine but in emulator and device there is this error -</p>
  
  <p>Response with status: 0 for URL: null</p>
  
  <p>Searched, tried a lot but could not find a workable solution. Please check codes below and help me resolve the issue.</p>
  
  <p><strong>ionic.config.json</strong></p>
  
  <pre><code>  "proxies": [
      {
        "path": "/login",
        "proxyUrl": "http://www.mydomain.coo/members/login"
      },
      {
        "path": "/update",
        "proxyUrl": "http://www.mydomain.coo/members/update"
      },
      {
        "path": "/register",
        "proxyUrl": "http://www.mydomain.coo/members/register"
      },
  </code></pre>
  
  <p><strong>login.ts</strong></p>
  
  <pre><code>  login() {
      this.showLoader('Authenticating...');
      this.postData = { isApp: '1', key: 'login', email:this.email, password:this.password };
  
      let data = JSON.stringify(this.postData);
  
      this.auth.login( this.postData ).then((result) =&gt; {
  
           this.loading.dismiss();
  
           this.data = result;
           if ( this.data.status == true )
           {
               localStorage.setItem('id', this.data.id);
  
      this.navCtrl.setRoot(TabsPage);
            }
            else
            {
              this.showLoader('Invalid Credentials...');
              this.loading.present();
              setTimeout(() =&gt; {
                this.loading.dismiss();
              }, 2000);
            }
  
      }, (err) =&gt; {
       this.loading.dismiss();
       this.presentToast(err);
      });
  
  
    }
  </code></pre>
  
  <p><strong>auth-service.ts</strong></p>
  
  <pre><code>  login(postData) {
  
      return new Promise((resolve, reject) =&gt; {
  
        let headers = new Headers( {
          'Access-Control-Allow-Origin' : '*',
          'Access-Control-Allow-Methods' : 'POST, GET, OPTIONS, PUT',
          'Content-Type': 'application/json; charset=UTF-8',
          'Accept': 'application/json'
        });
  
          this.http.post('/login', JSON.stringify(postData), {headers: headers})
  
          .subscribe(res =&gt; {
  
            resolve(res.json());
  
          }, (err) =&gt; {
            reject(err);
        });
  
  
  
      });
  
  
    }
  </code></pre>
  
  <p><strong>Codeigniter index.php file I have this</strong></p>
  
  <pre><code>header("Access-Control-Allow-Origin: *");
  header("Access-Control-Allow-Methods: POST, GET, OPTIONS");
  header("Access-Control-Allow-Headers: X-PINGOTHER, Content-Type");      
  header("Access-Control-Max-Age: 86400");
  </code></pre>