Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


OpenResty lua-resty-http unable to get local issuer certificate

OpenResty HTTPS 大约 451 字

错误信息

在请求https接口时,抛出了如下异常信息:

lua ssl certificate verify error: (20: unable to get local issuer certificate)

错误原因

lua-resty-http默认是开启了证书校验,而Nginx本地的证书与请求地址的证书不一致导致。

解决方法

lua-resty-http中发起请求时添加ssl_verify = false选项。

local http = require "resty.http"

local httpc = http.new()
local res, err = httpc:request_uri('https://www.test.com', {
    ssl_verify = false, -- 不校验证书
    keepalive_timeout = 2000 -- 毫秒
})

参考

https://github.com/ledgetech/lua-resty-http

阅读 4738 · 发布于 2021-05-10

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批