title: Javascript/JQuery Send custom header in OPTIONS Preflight API
body: <p>Code dump:</p>
  
  <pre><code>$.ajax({
     type: 'GET',
     dataType: 'json',
     url: api,
     xhrFields: {
       withCredentials: true
     },
     beforeSend: function (xhr) {
       xhr.setRequestHeader('Authorization', "Basic [my auth token]");
     },
     success: function(jd) {
        console.log(jd.stringify());
     }
  });
  </code></pre>
  
  <p>The problem is that Chrome and Firefox send an OPTIONS preflight when I include a beforeSend, however that OPTIONS request is refused by the API because it doesn't know how to handle an OPTIONS request and treats it like a GET, sees no Authorization header and refuses the request. </p>
  
  <p>The only way I can get this to work is to coerce the browser either to not send an OPTIONS request or include my header with it. I am unable to modify the API that I am using.</p>
  
  <p>I would appreciate it if anyone could advise me.</p>