1、在 OpenResty 中请求 https 网址报错:unable to get local issuer certificate。如图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
[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
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/181716.html