I am using Openresty web server and i am making subrequest from lua to hit fcgi .
when i am making a subrequest with GET request i am able to recieve response content from fcgi .
ngx.log(ngx.DEBUG, key .."\tVisitor found moking subrequest to django for response.")
res = ngx.location.capture(ngx.var.request_uri, {share_all_vars=true, copy_all_vars=true, always_forward_body = true})
ngx.header.content_type = res.header.content_type
ngx.print(res.body) -- body content is coming fine
But when i am making POST request from lua to fcgi. i am not able to get response content from fcgi .value of res.body is nil.
if ngx.req.get_method() == "POST" then
-- check if request method is POST
ngx.log(ngx.DEBUG, "Request method is POST so moving to django")
res = ngx.location.capture(ngx.var.request_uri, {method = ngx.HTTP_POST, share_all_vars=true, copy_all_vars=true, always_forward_body = true})
ngx.header.content_type = res.header.content_type
ngx.print(res.body) -- res.body is nil
ngx.exit(ngx.HTTP_OK)