title: Using Parse Client Key in Angular gives CORS error
body: <p>I am attempting to retrieve a class (with GET) from Parse using a client key. I was able to send a successful request using Advanced Rest Client for Google Chrome; I used <code>X-Parse-Application-Id</code> and <code>X-Parse-Client-Key</code> headers.</p>
  <p>[edit] [edit2]
  Response headers (obtained from Chrome Developer Tools OPTIONS):</p>
  <blockquote>
  <p>HTTP/1.1 200 OK</p>
  <p>Access-Control-Allow-Headers: X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, Content-Type</p>
  <p>Access-Control-Allow-Methods: OPTIONS, POST, GET, PUT, DELETE</p>
  <p>Access-Control-Allow-Origin: *</p>
  <p>Access-Control-Max-Age: 86400</p>
  <p>Content-Type: application/json; charset=utf-8</p>
  <p>Date: Sun, 29 Nov 2015 04:23:08 GMT</p>
  <p>Server: nginx/1.6.0</p>
  <p>X-Parse-Platform: G1</p>
  <p>X-Runtime: 0.000118</p>
  <p>Content-Length: 0</p>
  <p>Connection: keep-alive</p>
  </blockquote>
  <p>However, attempting to do the same in an Angular app gives me the following error:</p>
  <p><strong>XMLHttpRequest cannot load <a href="https://api.parse.com/1/classes/GenResources" rel="nofollow noreferrer">https://api.parse.com/1/classes/GenResources</a>. Request header field X-Parse-Client-Key is not allowed by Access-Control-Allow-Headers in preflight response.</strong></p>
  <p>Parse says it supports using <a href="https://parse.com/docs/rest/guide/#quick-reference-request-format" rel="nofollow noreferrer" title="cross-origin resource sharing">cross-origin resource sharing</a>, and I was able to make the request earlier using a different client so I'm pretty sure the server isn't the issue. I wouldn't be able to modify what the response header is anyways.</p>
  <p>Here's the code I used to form the GET request.</p>
  <pre><code>var ng_portal = angular.module(&quot;ngPortal&quot;, []);
  ng_portal.controller(&quot;GenResourcesCtrl&quot;, [&quot;$http&quot;, function($http) {
    $http({
      method: &quot;GET&quot;,
      url: PARSE_URL + &quot;/1/classes/GenResources&quot;,
      headers: {
        &quot;Content-Type&quot;: &quot;application/json&quot;,
        &quot;X-Parse-Application-Id&quot;: PARSE_APP_ID,
        &quot;X-Parse-Client-Key&quot;: PARSE_CLIENT_KEY
      }
    }).then(
      function success(res) {
        console.log(res);
      },
      function error(res) {
        console.log(res);
      }
    );
  }]);
  </code></pre>