Ionic http CORS same origin not allowed
<p>I'm trying to set a <a href="http://www.mailgun.com/" rel="nofollow">Mailgun mail service</a> in an ionic app. Here is the code:
Controller:</p>

<pre><code>$http({
                        "method": "POST",
                        "url": "https://api.mailgun.net/v3/" + mailgunUrl + "/messages",
                        //"crossDomain": "true",
                        "headers": {
                            "Access-Control-Allow-Origin": "*",//"http://localhost:8100",
                            "Access-Control-Allow-Headers": "content-type, accept",
                            //"Access-Control-Allow-Credentials": "true",
                            "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE",
                            "Content-Type": "application/x-www-form-urlencoded",
                            'Authorization' : 'Basic '+ mailgunApiKey
                            //"Authorization": "Basic " + mailgunApiKey//$base64.encode('api:key-'+mailgunApiKey)
                        },
                        data: "from=" + "no-reply@ineevent.com" + "&amp;to=" + $scope.datapopup.mail + "&amp;subject=" + "Guestlist" + "&amp;text=" 
</code></pre>

<p>config.xml</p>

<pre><code>&lt;content src="main.html"/&gt;
  &lt;access origin="*"/&gt;
  &lt;plugin name="cordova-plugin-whitelist" version="1"/&gt;
  &lt;plugin name="cordova-plugin-crop" spec="~0.1.0"/&gt;
  &lt;allow-navigation href="*" /&gt;
  &lt;allow-intent 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;
</code></pre>

<p>I receive the <code>status '0' error</code> and the logs show that CORS (Cross-Origin request) is not allowed with access-control-allow-headers missing (translated from french).</p>

<p>Another error from Chrome is <code>'Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.'</code>. </p>

<p>I tried also from android device but is not working. Any idea?</p>