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[2] = true
}
I had originally, not had the line for ngx.arg[2] = true
, but I would get back the body twice (does that mean the body I'm replacing has 2 chunks?). I added in the ngx.arg[2] = true
line and now the output from the request looks good. When I deploy the nginx
file, the service looks good for a few requests then the nginx
requests start to hang. Is the correct/best practice for replacing the response body? What should I do instead?