使用 Firefox 访问 API 时收到 restdb.io 错误

Error received while accessing restdb.io API using Firefox

本文关键字:restdb io 错误 Firefox 访问 API 使用      更新时间:2023-09-26

我在使用 restdb.io 和 Firefox 时遇到以下问题:

以下代码在使用 Firefox(44.x 和 45.0)时返回错误

function getData(){
   var jqhxr = $.ajax({
                           type: 'GET',
                            url: 'https://<-my REST endpoint->',
                        "async": true,
                  "crossDomain": true,
                       dataType: 'json',
                      "headers": {
                                  "x-apikey": "<-my API key->",
                                  "content-type": "application/json" }
                       }).done(function() {
                           console.log('success');
                       }).fail(function(jqXHR, textStatus) {
                           console.log('request failed jqXHR: ' +  JSON.stringify(jqXHR));
                           console.log('request failed: ' +  textStatus);
                       }).always(function() {
                           console.log('complete');
                   });
          }

收到的 JSON 有效负载为:

request failed jqXHR: {"readyState":0,"responseText":"","status":0,"statusText":"error"}

但是相同的代码使用 Chrome (48.0.2564.116 m) 和 IExplorer (11.0.9600.17420) 运行正常。

知道为什么会出现这个 restDB.io/Firefox 问题或我该如何解决它吗?

从版本 43 开始,Firefox 包含了一项更改,以拒绝使用称为"SHA-1"的旧算法制作的新安全证书。

出现此问题的原因是您使用的第三方应用程序拦截浏览器建立的安全连接。

本文介绍如何查看此问题是否影响您,如果是,如何解决它:

mozill 支持 - 无法访问 Firefox 43 中的安全 (HTTPS) 站点

解决此问题的最佳方法是从Firefox下载页面安装最新版本的Firefox,该页面可以解决此问题。您需要手动下载并运行 Firefox 安装程序,使用不受影响的 Firefox 副本或其他浏览器。