【问题标题】:Cert Revoked when calling API to my server with self signed cert使用自签名证书向我的服务器调用 API 时证书被撤销
【发布时间】:2020-02-16 19:37:24
【问题描述】:

我在 ReactJS 中使用 Axios 来调用我的 API,该 API 使用自签名证书托管在云上。请求的错误返回 net::ERR_CERT_REVOKED。

我已将自签名代码添加到我在运行 reactjs 的 MacOS 上的登录钥匙串中。但是当我在 Chrome 的日志中查看错误时,证书仍然被吊销。在 safari 上,错误是 Failed to load resource: The certificate for this server is invalid.

try {
        const response = await axios.post(
            'https://1.1.1.1:3000/login',
            { withCredentials: true },
            { auth: apiAuth },
            { data: bodyFormData },
            { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
          )
          return response.data;
    } catch (error) {
        console.log(error);
    }

问题的 IP 地址已更改。

我尝试在 Axios 请求中使用以下代码,但没有帮助

const agent = new https.Agent({  
  rejectUnauthorized: false
});

期望服务器给出响应,但作为响应被撤销证书。

【问题讨论】:

    标签: node.js reactjs ssl


    【解决方案1】:

    自签名证书 ... net::ERR_CERT_REVOKED ... MacOS

    您可能会遇到 MacOS 10.15 和 iOS 13 中对证书的新要求,这些要求似乎也适用于自签名证书。虽然您没有提供有关您的特定证书的任何详细信息,但我猜它的有效期超过 825 天。当然,它也可能是任何其他新要求 - 有关详细信息,请参阅 Requirements for trusted certificates in iOS 13 and macOS 10.15

    【讨论】:

      猜你喜欢
      • 2020-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-15
      • 2019-05-13
      相关资源
      最近更新 更多