title: AngularJS: Refused to set unsafe header "Access-Control-Request-Headers"
body: <p>I'm trying to call a REST API running locally using AngularJS. Here is the AngularJS code : </p>
  
  <pre><code>$http.defaults.headers.common = {"Access-Control-Request-Headers": "accept, origin, authorization"};
  
  $http.defaults.headers.common['Authorization'] = 'Basic amF5M2RlYzpqYXk=';
  $http({method: 'GET', url: 'http://127.0.0.1:5000/user/jay3dec'}).
          success(function(data, status, headers, config) {
  
          }).
          error(function(data, status, headers, config) {
              alert(data);
  
          });
  </code></pre>
  
  <p>But I'm getting an errors in the browser console :</p>
  
  <pre><code>Refused to set unsafe header "Access-Control-Request-Headers" 
  </code></pre>
  
  <p>I tried to query call the REST API running at <a href="http://127.0.0.1:5000/user/jay3dec" rel="noreferrer">http://127.0.0.1:5000/user/jay3dec</a> using CURL.</p>
  
  <pre><code>curl -H "Origin: http://127.0.0.1:8000" -H "Authorization: Basic amF5M2RlYzpqYXk=" http://127.0.0.1:5000/user/jay3dec --verbose
  </code></pre>
  
  <p>And it gave the following output :</p>
  
  <pre><code>&gt; GET /user/jay3dec HTTP/1.1
  &gt; User-Agent: curl/7.35.0
  &gt; Host: 127.0.0.1:5000
  &gt; Accept: */*
  &gt; Origin: http://127.0.0.1:8000
  &gt; Authorization: Basic amF5M2RlYzpqYXk=
  &gt; 
  * HTTP 1.0, assume close after body
  &lt; HTTP/1.0 200 OK
  &lt; Content-Type: application/json
  &lt; Content-Length: 454
  &lt; ETag: bff7b7db33baedb612276861e84faa8f7988efb1
  &lt; Last-Modified: Tue, 30 Dec 2014 14:32:31 GMT
  &lt; Access-Control-Allow-Origin: *
  &lt; Access-Control-Allow-Headers: Authorization
  &lt; Access-Control-Allow-Methods: HEAD, OPTIONS, GET
  &lt; Access-Control-Allow-Max-Age: 21600
  &lt; Server: Eve/0.4 Werkzeug/0.9.6 Python/2.7.6
  &lt; Date: Sun, 25 Jan 2015 20:00:29 GMT
  &lt; 
  * Closing connection 0
  {"username": "jay3dec", "_updated": "Tue, 30 Dec 2014 14:32:31 GMT", "password": "jay", "firstname": "jay", "lastname": "raj", "phone": "9895590754", "_links": {"self": {"href": "/user/54a2b77f691d721ee170579d", "title": "User"}, "parent": {"href": "", "title": "home"}, "collection": {"href": "/user", "title": "user"}}, "_created": "Tue, 30 Dec 2014 14:32:31 GMT", "_id": "54a2b77f691d721ee170579d", "_etag": "bff7b7db33baedb612276861e84faa8f7988efb1"}
  </code></pre>
  
  <p>Can any one spot what may be the issue ??</p>