title: Angular $HTTP: CORS issues
body: <p>I keep getting a 502 error when I do a call to my API point using <code>$http</code> in angular.<br>
  The exact error says this:</p>
  
  <blockquote>
    <p>Failed to load <a href="https://xxxxxxxxx.execute-api.eu-west-2.amazonaws.com/dev/api/fund" rel="nofollow noreferrer">https://xxxxxxxxx.execute-api.eu-west-2.amazonaws.com/dev/api/fund</a>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>' is therefore not allowed access. The response had HTTP status code 502.</p>
  </blockquote>
  
  <p>I have however checked using Postman if that header was in the response and it is: </p>
  
  <pre><code>Access-Control-Allow-Origin →*
  Connection →keep-alive
  Content-Length →30
  Content-Type →application/json
  Date →Tue, 03 Jul 2018 10:01:11 GMT
  Via →1.1 xxxxxxxxxxxxxxxxxxxxxxxxxxxx.cloudfront.net (CloudFront)
  </code></pre>
  
  <p>When I do an OPTIONS call to the same URL here is the header of the response using Postman:</p>
  
  <pre><code>Access-Control-Allow-Credentials →false
  Access-Control-Allow-Headers →Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent
  Access-Control-Allow-Methods →OPTIONS,POST
  Access-Control-Allow-Origin →*
  Connection →keep-alive
  Content-Length →0
  Content-Type →application/json
  Date →Tue, 03 Jul 2018 10:18:17 GMT
  Via →1.1 xxxxxxxxxxxxxxxx.cloudfront.net (CloudFront)
  X-Amz-Cf-Id →T_CC-vaqRAoxqnzFZdB9KMI9CAIPQvKAxCat2NPLyaJ5MPpdTVhF1g==
  X-Cache →Miss from cloudfront
  x-amz-apigw-id →JckIhHWmrPEFcqQ=
  x-amzn-RequestId →675517fc-7eaa-11e8-8290-39c903c321e4
  </code></pre>
  
  <p>Here is the code i have been trying to call the API, pretty straight forward I am really confused on what could be the error:</p>
  
  <pre><code>  $scope.fundAsset = function(assetID, userID){
      $http({
        method: 'POST',
        url: 'https://xxxxxxxxxxx.execute-api.eu-west-2.amazonaws.com/dev/api/fund',
        body: {
          userID: userID,
          assetID: assetID
        }
      }).then(function successCallback(response) {
        console.log(response);
      });
    };
  </code></pre>