Hello everybody,
i'm starting to use openresty and lua and i would use pintsized/lua-resty-http to make subrequests.
nginx.conf
location /subreq {
resolver 8.8.8.8;
lua_code_cache off;
content_by_lua_file /usr/local/openresty/lua/capture.lua;
}
capture.lua
function req ()
local h = ngx.req.get_headers()
local params = {
method = "GET",
headers = {
["User-Agent"] = h["user-agent"],
["Accept-Encoding"] = h["accept-encoding"],
["Accept-Language"] = h["accept-language"],
["Accept"] = h["accept"]
}
}
local link = 'https://google.com'
local http = require "resty.http"
local httpc = http.new()
local res, err = httpc:request_uri(link, params)
if err then
httpc:close()
return ngx.print(err)
end
httpc:close()
ngx.print(res.status)
end
req ()
I get
"20: unable to get local issuer certificate"
Can somebody advise how can i fix it. Or get small code to understand how can i make https subreq, if it possible with resty.http.
Thank you in advance.
Andre