美文网首页
20: unable to get local issuer c

20: unable to get local issuer c

作者: VIL凌霄 | 来源:发表于2018-06-05 09:52 被阅读0次

    20: unable to get local issuer certificate

    这个是证书加载问题,在 OpenResty lua 中 使用 request.url 请求其他的 https 接口报这个错误,是因为 openresty 作为客户端访问其他的 https接口不需要加载证书,解决方法:

    local dt = "a=b"
    local res, err = httpc:request_uri(
            "https://api.weixin.qq.com/sns/jscode2session?"..dt,
            {
                ssl_verify = ssl_verify or false, -- 设置参数 ssl_verify 为false即可
                method = "GET",
                headers = {
                    ["Content-Type"] = "application/x-www-form-urlencoded",
                }
            }
        )
    

    no resolver defined to resolve

    这个是在nginx中 lua 脚本需要使用域名访问其他接口,需指定域名解析服务,解决方法在Nginx 中添加 配置

    location /getOpenID{
            resolver 8.8.8.8;
            default_type 'text/plain';
            charset UTF-8;
            ...
        }
    
    

    相关文章

      网友评论

          本文标题:20: unable to get local issuer c

          本文链接:https://www.haomeiwen.com/subject/yuxpsftx.html