title: Angular Cross-Origin Request CORS failure, but node http.get() returns successfully
body: <p>I am trying to access an API using AngularJS. I have checked the API functionality with the following node code. This rules out that the fault lies with</p>
  
  <pre><code>var http = require("http");
  url = 'http://www.asterank.com/api/kepler?query={"PER":{"$lt":1.02595675,"$gt":0.67125}}&amp;limit=10';
  
  var request = http.get(url, function (response) {
      var buffer = ""
      response.on("data", function (chunk) {
          buffer += chunk;
      });
      response.on("end", function (err) {
          console.log(buffer);
          console.log("\n");
      });
  });
  </code></pre>
  
  <p>I run my angular app with node http-server, with the following arguments</p>
  
  <pre><code>"start": "http-server --cors -a localhost -p 8000 -c-1"
  </code></pre>
  
  <p>And my angular controller looks as follows</p>
  
  <pre><code>app.controller('Request', function($scope, $http){
      // functional URL = http://www.w3schools.com/website/Customers_JSON.php
      $scope.test = "functional";
      $scope.get = function(){
  
          $http.get('http://www.asterank.com/api/kepler?query={"PER":{"$lt":1.02595675,"$gt":0.67125}}&amp;limit=10',{
              params: {
                  headers: {
                      //'Access-Control-Allow-Origin': '*'
                      'Access-Control-Request-Headers' : 'access-control-allow-origin'
                  }
              }
          })
              .success(function(result) {
                  console.log("Success", result);
                  $scope.result = result;
              }).error(function() {
                  console.log("error");
              });
          // the above is sending a GET request rather than an OPTIONS request
      };
  });
  </code></pre>
  
  <p>The controller can parse the w3schools URL, but it consistently returns the CORS error when passed the asterank URL.
  My app avails of other remedies suggested for CORS on this site (below).</p>
  
  <p>Inspecting the GET requests through Firefox shows that the headers are not being added to the GET request. But beyond that I do not know how to remedy this. Help appreciated for someone learning their way through Angular.</p>
  
  <p>I have tried using $http.jsonp(). The GET request executes successfully (over the network) but the angular method returns the .error() function. </p>
  
  <pre><code>var app = angular.module('sliderDemoApp', ['ngSlider', 'ngResource']);
      .config(function($httpProvider) {
          //Enable cross domain calls
          $httpProvider.defaults.useXDomain = true;
          delete $httpProvider.defaults.headers.common['X-Requested-With'];
      });
  </code></pre>