在 OpenResty 中请求 https 网址报错:unable to get local issuer certificate

1、在 OpenResty 中请求 https 网址报错:unable to get local issuer certificate。如图1

图1

{
  "code": 11003,
  "message": "Http请求SCMS积分接口调用失败:20: unable to get local issuer certificate"
}

2、参考网址:https://github.com/ledgetech/lua-resty-http/issues/68 。client:request_uri(url, { ssl_verify = false, })。

3、编辑请求客户端代码,lua-resty-http 中发起请求时添加 ssl_verify = false 选项。如图2

图2


[lua]
local res, err_ = httpc:request_uri(url, {
ssl_verify = false,
method = “POST”,
body = body,
headers = {
[“Content-Type”] = “application/x-www-form-urlencoded”,
[“authorization”] = authorization,
}
})
[/lua]

4、在 OpenResty 中请求 https 网址,未再报错,符合预期。如图3

图3

永夜