9 questions
1
vote
1
answer
93
views
Is the ngx.socket.tcp() call limited in any way when called from an nginx location context?
I'm very new to using the local sock = ngx.socket.tcp() call that is provided by the nginx lua packages provided on Ubuntu Noble (i.e. the libnginx-mod-http-lua package). I've been able to get some ...
0
votes
0
answers
71
views
How do I return a response from the destination server in case of an error in Nginx?
I need to always return in case of errors. 400, 401, 403, 404, 500... my html pages with errors if the response is from the destination server is text/html, otherwise I can return the server's ...
1
vote
1
answer
238
views
Work-around for co-socket api's not being available in log_by_lua giving 404 error
I've been banging my head on this problem for a few days now, and have gotten a bit stuck, so I thought I'd ask here. Would really appreciate any help.
Context:
The issue that I'm currently facing ...
0
votes
1
answer
1k
views
Return a boolean from lua nginx module's set_by_lua_block method
I'm using lua nginx module in my nginx conf file. I'm trying to set a value variable during runtime depending on some injected parameters. However, I can not return a boolean from the block without ...
2
votes
0
answers
596
views
how to http request with Lua when Nginx start and restart
I am using Lua Nginx module in my nginx server.
I have a Lua script which is execute by init_worker_by_lua_file in nginx.conf so the script will execute when nginx start and restart.
What the Lua ...
0
votes
0
answers
210
views
I need to iterate user-data in Lua
I am reading the ngnix client certificate and storing it in a local variable.
local client_cert = openssl_x509.new(ngx.var.ssl_client_raw_cert)
local subject = client_cert:getSubject()
I need to get ...
1
vote
1
answer
3k
views
Kong API Gateway - Reading request body in custom plugin
I am trying to read the request body in a custom plugin by following this url
local data = kong.request.get_body()
if data then
kong.log(data)
end
I am getting the following error
2019/03/...
1
vote
1
answer
3k
views
Use NGINX to replace body from proxy_pass
I am new to openresty/nginx and am trying to replace the body the comes from an earlier call to proxy_pass with code like this:
body_filter_by_lua_block {
ngx.arg[1] = '{"count"' .. ":2}'
ngx.arg[...
4
votes
2
answers
8k
views
ngx lua: scope of local variable, init in init_by_lua_block
I'm new to nginx lua, and got a setup from previous developer. Trying to go through the docs to understand the scope but I'm pretty unsure.
It's like this right now
init_by_lua_block {
my_module ...