Get request_body in set_by_lua directive
agentzh
agentzh at gmail.com
Mon Apr 29 03:09:13 UTC 2013
Hello!
On Sun, Apr 28, 2013 at 12:13 PM, maanas wrote:
> Thanks it help me as well. I was trying to read request post body in
> set_by_lua directive
>
No, the request body is not read yet at the phase where set_by_lua
(and those ngx_rewrite directives) runs. Try using the rewrite_by_lua
directive instead where you can call ngx.req.read_body() in Lua to
explicitly read the request body (otherwise the body is still not
read):
http://wiki.nginx.org/HttpLuaModule#ngx.req.read_body
But note that by default, rewrite_by_lua always runs after those
ngx_rewrite directives like "set" or "if". If you want the other way
around, just turn on the rewrite_by_lua_no_postpone directive:
http://wiki.nginx.org/HttpLuaModule#rewrite_by_lua_no_postpone
Best regards,
-agentzh
More information about the nginx
mailing list