title: jQuery ajax Authorization Token Header Fails
body: <p>jQuery 1.9.1</p>
  
  <p>The request never gets sent and seems to just error out. <code>console.log</code> output shows <code>Request failed: error</code> I do not know how to debug this further.</p>
  
  <pre><code>$.ajax({
      beforeSend: function (xhr) { xhr.setRequestHeader ('Authorization', 'Token c576f0136149a2e2d9127b3901015545') },
      type: "GET",
      url: "https://example.com/endpoint",
      dataType: "json"
  }).done(function( msg ) {
      console.log( msg );
  }).fail(function(jqXHR, textStatus, errorThrown) {
      console.log( "Request failed: " + textStatus );
      console.log( errorThrown );
  });
  </code></pre>
  
  <p>Inspecting the network traffic in google chrome shows</p>
  
  <ul>
  <li><code>Method: OPTIONS</code></li>
  <li><code>Status: (canceled)</code></li>
  <li><code>Type: Pending</code></li>
  </ul>
  
  <p>However using curl works fine:</p>
  
  <p><code>curl https://example.com/endpoint -H 'Authorization: Token token="c576f0136149a2e2d9127b3901015545"'</code></p>
  
  <p>Here is the jsFiddle: <a href="http://jsfiddle.net/2vtyD/1/" rel="nofollow">http://jsfiddle.net/2vtyD/1/</a> </p>
  
  <p>Note: this is not an issue with <code>Access-Control-Allow-Origin</code> as I have this part working.</p>
  
  <p>I know I must be missing something...</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Everything works fine when I switch to <code>http</code>. It is only when using <code>https</code> this problem occurs. I thought it might be because I am using a self-signed certificate (invalid). But other SSL requests (non-authorization ie not 'OPTIONS' ) work just fine. So it only seems to be a combination of SSL and OPTIONS requests. The status in chrome says canceled and from looking at the server logs apache logs shows some activity but it never makes it the rails web app.</p>
  
  <p>Here is a sniplet of the apache log:</p>
  
  <pre><code>[info] [client 10.0.2.2] (70007)The timeout specified has expired: SSL input filter read failed.
  [info] [client 10.0.2.2] Connection closed to child 10 with standard shutdown (server example.com:443)
  [info] [client 10.0.2.2] Connection to child 11 established (server example.com:443)
  [info] Seeding PRNG with 656 bytes of entropy
  [info] [client 10.0.2.2] (70014)End of file found: SSL input filter read failed.
  [info] [client 10.0.2.2] Connection closed to child 11 with standard shutdown (server example.com:443)
  </code></pre>
  
  <p>However, these types of messages are occurring for all SSL requests. So I am basically at a loss on how to proceed.</p>