location /test_get_https {
content_by_lua '
-- require pintsized/lua-resty-http according your path
local http = require"resty.http"
local httpc = http.new()
httpc:set_timeout(2000)
local res, err = httpc:request_uri("https://$real_ip_of_the_site", {
method = "GET",
headers = {
Host="www.baidu.com",
},
-- ssl_verify: default is false in pintsized/lua-resty-http
-- lua-ngx: when set to true, the server certificate will be \
-- verified according to the CA certificates specified by the \
-- lua_ssl_trusted_certificate directive.
ssl_verify=false,
})
ngx.say(ngx.var.http_host)
if not res then
ngx.say("<<<>>>failed to request: ", err)
return
end
ngx.status = res.status
for k,v in pairs(res.headers) do
--
ngx.say("--> "..k.. ":".. tostring(v) )
end
ngx.say(res.body)
';
}
在 2015年10月27日星期二 UTC+8上午10:50:18,Yun Thanatos写道:
如题!
之前没有做过 是否只要在原先http交互之前 加上tcpsock:sslhandshake即可?
正准备试验一下 完成之后把结论发上来 (如果有之前做过的前辈 欢迎分享您的答案:)