IP地址的SSL / TSL证书

时间:2020-06-09 06:58:26

标签: javascript reactjs ssl ssl-certificate

我有以下curl命令向用户(本地)授予权限:

curl "https://10.10.135.35/9880/grant_permission?user=username&role=role" -k

我想出于相同目的在js中使用提取。像这样:

const fetchAPIPro = (username, role) =>
    fetch(`https://10.10.135.35/9880/grant_permission?user=${username}&role=${role}`, {
      referrerPolicy: 'unsafe-url',
      credentials: 'omit',
    })
      .then((response) => {
        if (!response.ok) {
          throw new Error('Network response was not ok');
        }
        return response.blob();
      })
      .then((response) => response.json())
      .then((data) => console.log(data))
      .catch((error) => {
        console.error('There has been a problem with your fetch operation:', error);
      });

它返回了NET::ERR_CERT_INVALID。我认为发生这种情况是因为我创建了SSL / TSL认证(自签名)。 无论如何,有没有绕过fetch中的操作或授予域认证?

2 个答案:

答案 0 :(得分:0)

您需要在标题中添加from datetime import datetime, timedelta def _one_month_before(dt: datetime) -> datetime: return (dt.replace(day=1) - timedelta(1)).replace(day=dt.day) def _one_month_after(dt: datetime) -> datetime: new_month = max(1, (dt.month + 1) % 12) return dt.replace(month=new_month, year=dt.year + (new_month == 1)) for biweekly_dt in biweekly: # First, filter the target dataframe by the desired months: lower = _one_month_before(biweekly_dt) upper = _one_month_after(biweekly_dt) frames_in_range = weekly[(weekly.DateTime >= lower) & (weekly.DateTime <= upper)] # frames_in_range holds the weeks to randomly pick from. So: result = frames_in_range.sample(1)

答案 1 :(得分:0)

如果您正在浏览器中执行,则将引发该错误,因为浏览器不针对跨源域的自签名证书进行验证。您可以从letsencrypt获取免费的有效证书