zoukankan      html  css  js  c++  java
  • node后台fetch请求数据-Hostname/IP doesn't match certificate's altnames解决方法

       一、问题背景

         基于express框架,node后台fetch请求数据,报错Hostname/IP doesn't match certificate's altnames。。。。。

    require('isomorphic-fetch');
    
    fetch(url)

    二 、两种方式解决。

      1、设置rejectUnauthorized:false

    const https = require("https");
    
    const options = {
      agent: new https.Agent({
        rejectUnauthorized: false
      })
    };
    
    fetch(url, options)
    

      2、当前服务器hosts 文件设置

    // hosts文件配置
    10.x.x.x  api.weixin.qq.com
    
    
    
    // 之前访问的URL为,那么就对应到了10.x.x.x的服务器转发了
    fetch('api.weixin.qq.com/getticket/xxxxx')
    
    // 如果10.x.x.x代理服务器有端口号8090,那么fetch地址也要加上端口号8090
    
    fetch('api.weixin.qq.com:8090/getticket/xxxxx')
    

      

  • 相关阅读:
    10 查看创建表的语句:show create table emp;
    9 常用命令?
    8 如何查看表中的数据?
    7 查看表结构
    构建之法阅读笔记3
    每日汇报
    每周总结
    每日汇报
    每周总结
    每日总结
  • 原文地址:https://www.cnblogs.com/ldld/p/10826012.html
Copyright © 2011-2022 走看看