title: IONIC2 , Angular 2 Http request error on device - access to file:// instead http://
body: <p>I have a problem with make request for my server in IONIC 2 App.</p>
  
  <p>In ionic.config.json I 've set up proxies (my rest API is availabe directly from <a href="http://SERVER_ADDRESS.pl" rel="nofollow">http://SERVER_ADDRESS.pl</a> ):</p>
  
  <pre><code>"proxies": [{
      "path": "/rest",
      "proxyUrl": "http://SERVER_ADDRESS.pl"
  }]
  </code></pre>
  
  <p>In my ts file I have:</p>
  
  <pre><code>this.http.get(`/rest/getmenu`)
  .map(res =&gt; res.json())
  .subscribe(res =&gt; {
          this.menus = res;
          console.log(this.menus);
      },
      err =&gt; {
          console.log(err);
          this.error = err;
      }
  );
  </code></pre>
  
  <p>In config.xml I've added:</p>
  
  <pre><code>&lt;allow-navigation href="*" /&gt;
  </code></pre>
  
  <p>When I start by "ionic serve" everything is ok, but when I run on emualtor I've got error. When I debugged on Chrome, I can see error:</p>
  
  <p><strong>Failed to load resource: net::ERR_FILE_NOT_FOUND file:///rest/getmenu</strong></p>
  
  <p><strong>How fix it ?</strong></p>
  
  <p>I've installed cordova-plugin-whitelist (cordova-plugin-whitelist 1.2.3-dev "Whitelist") .
  My config.xml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
      &lt;name&gt;V2 Test&lt;/name&gt;
      &lt;description&gt;An Ionic Framework and Cordova project.&lt;/description&gt;
      &lt;author email="hi@ionicframework" href="http://ionicframework.com/"&gt;Ionic Framework Team&lt;/author&gt;
      &lt;content src="index.html" /&gt;
      &lt;access origin="*" /&gt;
      &lt;allow-navigation href="*" /&gt;
      &lt;allow-intent href="http://*/*" /&gt;
      &lt;allow-intent href="https://*/*" /&gt;
      &lt;allow-intent href="tel:*" /&gt;
      &lt;allow-intent href="sms:*" /&gt;
      &lt;allow-intent href="mailto:*" /&gt;
      &lt;allow-intent href="geo:*" /&gt;
      &lt;platform name="android"&gt;
          &lt;allow-intent href="market:*" /&gt;
      &lt;/platform&gt;
      &lt;platform name="ios"&gt;
          &lt;allow-intent href="itms:*" /&gt;
          &lt;allow-intent href="itms-apps:*" /&gt;
      &lt;/platform&gt;
      &lt;preference name="webviewbounce" value="false" /&gt;
      &lt;preference name="UIWebViewBounce" value="false" /&gt;
      &lt;preference name="DisallowOverscroll" value="true" /&gt;
      &lt;preference name="android-minSdkVersion" value="16" /&gt;
      &lt;preference name="BackupWebStorage" value="none" /&gt;
      &lt;feature name="StatusBar"&gt;
          &lt;param name="ios-package" onload="true" value="CDVStatusBar" /&gt;
      &lt;/feature&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p>And ionic info:</p>
  
  <pre><code>Cordova CLI: 4.3.1
  Gulp version:  CLI version 3.9.0
  Gulp local:   Local version 3.9.1
  Ionic Framework Version: 2.0.0-beta.4
  Ionic CLI Version: 2.0.0-beta.25
  Ionic App Lib Version: 2.0.0-beta.15
  OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS 
  Node Version: v4.0.0
  </code></pre>