Closed luvpreetsingh closed 3 years ago
I think the issue comes when I try to access ngx.var.host
Document ssl_session_fetch_by_lua_block
Lua APIs that may yield, like ngx.sleep and cosockets, are enabled in this context.
Hmm, maybe I was quick to open this issue here but I think the error lead me to think there was an issue with the library and not my code.
I have got this covered. I don't know why I was using ngx.var.host
but ngx.ssl provide a built in method to get the domain name inside this block, here which I was not aware of earlier. I did not read the documentation clearly.
Sorry to create an issue for this. I feel stupid but also not so stupid because I have finally got it working.
Thank you for this repo.
Details
openresty/openresty:alpine-fat
Scenario
I have my ssl certs in a mysql database. I am trying to set the ssl certs based on the domain names which are being accessed. So, I wanted to use
lua-resty-mysql
. I tested it with a single domain first and it was working fine. Here is the code,This worked very well for me. But then I made a single change in my query. Here is the change,
I just wanted to take the domain name from the host variable so that all the domains in my db can get served. But I started getting the error below,
This error is repeated 4 times during a single call.
I have seen this issue here. I get that this should not work in the set_by_lua context. And I think in my code, when I am using
set_der_cert
andset_der_priv_key
, it might be using the set context.Firstly, I have a question as to why it works when the domain name is fixed in the query? And what changes when I start to take the domain name from the variable?
Secondly, in the issue I mentioned, they suggested using
rewrite_by_lua
. But I am not able to figure out how can I userewrite_by_lua
in my scenario.Thank you for your time. Any help is appreciated.