Description
luajit -v
LuaJIT 2.1.1710398010 -- Copyright (C) 2005-2023 Mike Pall. https://luajit.org/
nignx -V
configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --with-http_lua_module --with-threads --with-file-aio --with-select_module --with-poll_module --with-http_ssl_module --with-http_stub_status_module --with-http_degradation_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-stream_sni --with-stream_ssl_preread_module --with-openssl=/opt/compile/depend/Tongsuo--with-openssl-opt='--api=1.1.1 enable-ntls' --add-module=modules/ngx_openssl_ntls --add-module=/opt/compile/depend/headers-more-nginx-module-0.33
nginx.conf
lua_package_path '/opt/luarocks/share/lua/5.1/?.lua;;';
lua_package_cpath '/opt/luarocks/lib/lua/5.1/?.so;;';
location ^~ /lua {
content_by_lua_block {
local json = require("cjson")
local http = require("resty.http")
local uri = "https://www.baidu.com"
ngx.log(ngx.ERR, "request url: " .. uri)
ngx.say("request to ", uri)
local httpc = http.new()
local res, err = httpc:request_uri(uri, {
method = "GET",
})
if not res then
ngx.say("Failed to post request to ", uri, ": ", err)
return
end
ngx.say("Status: ", res.status)
ngx.say("Body: ", res.body)
}
}
error.log
2024/05/10 18:12:29 [info] 4698#4698: *39 SSL_do_handshake() failed (SSL: error:0A000416:SSL routines::sslv3 alert certificate unknown:SSL alert number 46) while SSL handshaking, client: 10.11.47.29, server: 0.0.0.0:443
2024/05/10 18:12:29 [info] 4698#4698: *40 SSL_do_handshake() failed (SSL: error:0A000416:SSL routines::sslv3 alert certificate unknown:SSL alert number 46) while SSL handshaking, client: 10.11.47.29, server: 0.0.0.0:443
2024/05/10 18:12:29 [warn] 4698#4698: *41 [lua] http_connect.lua:21: failed to load module resty.openssl.*
, mTLS isn't supported without lua-resty-openssl:
/opt/luarocks/share/lua/5.1/resty/http_connect.lua:15: module 'resty.openssl.x509.chain' not found:
no field package.preload['resty.openssl.x509.chain']
no file '/opt/luarocks/share/lua/5.1/resty/openssl/x509/chain.lua'
no file './resty/openssl/x509/chain.lua'
no file '/usr/local/share/luajit-2.1/resty/openssl/x509/chain.lua'
no file '/usr/local/share/lua/5.1/resty/openssl/x509/chain.lua'
no file '/usr/local/share/lua/5.1/resty/openssl/x509/chain/init.lua'
no file '/opt/luarocks/lib/lua/5.1/resty/openssl/x509/chain.so'
no file './resty/openssl/x509/chain.so'
no file '/usr/local/lib/lua/5.1/resty/openssl/x509/chain.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/opt/luarocks/lib/lua/5.1/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/opt/luarocks/share/lua/5.1/resty/http_connect.lua:15: in function </opt/luarocks/share/lua/5.1/resty/http_connect.lua:14>
[C]: in function 'xpcall'
/opt/luarocks/share/lua/5.1/resty/http_connect.lua:14: in main chunk
[C]: in function 'require'
/opt/luarocks/share/lua/5.1/resty/http.lua:166: in main chunk
[C]: in function 'require'
content_by_lua(login.conf:76):5: in main chunk, client: 10.11.47.29, server: , request: "GET /lua HTTP/1.1", host: "10.50.89.231"
2024/05/10 18:12:29 [error] 4698#4698: *41 [lua] content_by_lua(login.conf:76):13: request url: https://www.baidu.com, client: 10.11.47.29, server: , request: "GET /lua HTTP/1.1", host: "10.50.89.231"
2024/05/10 18:12:29 [debug] 4698#4698: *41 [lua] http_connect.lua:253: connect(): poolname: https:www.baidu.com:443:true:www.baidu.com:false:::
2024/05/10 18:12:29 [notice] 13827#13827: signal 17 (SIGCHLD) received from 4698
2024/05/10 18:12:29 [alert] 13827#13827: worker process 4698 exited on signal 11
Does the lua-resty-http library have compatibility issues with the TongSuo SSL library?