jQuery ajax授权令牌头失败

jQuery ajax授权令牌头失败,ajax,jquery,ssl,http-headers,Ajax,Jquery,Ssl,Http Headers,jQuery 1.9.1 请求从未被发送,似乎只是出错了控制台。日志输出显示请求失败:错误我不知道如何进一步调试 $.ajax({ beforeSend: function (xhr) { xhr.setRequestHeader ('Authorization', 'Token c576f0136149a2e2d9127b3901015545') }, type: "GET", url: "https://example.com/endpoint", dataT

jQuery 1.9.1

请求从未被发送,似乎只是出错了<代码>控制台。日志输出显示请求失败:错误我不知道如何进一步调试

$.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 );
});
在谷歌chrome展会上检查网络流量

  • 方法:选项
  • 状态:(已取消)
  • 类型:挂起
但是,使用curl很好:

curlhttps://example.com/endpoint -H'授权:令牌令牌=“c576f0136149a2e2d9127b3901015545”

以下是JSFIDLE:

注意:
Access Control Allow Origin
不存在这一问题,因为我有这个部件在工作

我知道我一定错过了什么

更新:

当我切换到
http
时,一切正常。只有在使用
https
时才会出现此问题。我想这可能是因为我使用的是自签名证书(无效)。但其他SSL请求(非授权,即非“选项”)工作正常。因此,它似乎只是SSL和选项请求的组合。chrome中的状态表示已取消,从服务器日志来看,apache日志显示了一些活动,但它从未使其成为rails web应用程序

以下是apache日志的剪贴画:

[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)

但是,所有SSL请求都会出现这些类型的消息。因此,我基本上不知道如何继续。

使用有效的SSL证书

出于某种原因,GET、POST、PUT和DELETE请求可以与自签名证书一起正常工作。但选项请求没有。使用有效的SSL证书,一切都会正常工作