Welcome! Log In Create A New Profile

Advanced

Re: Get request_body in set_by_lua directive

agentzh
April 28, 2013 11:10PM
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Get request_body in set_by_lua directive

rishabh March 15, 2012 06:59AM

Re: Get request_body in set_by_lua directive

agentzh March 15, 2012 10:32PM

Re: Get request_body in set_by_lua directive

rishabh March 19, 2012 06:02AM

Re: Get request_body in set_by_lua directive

agentzh March 19, 2012 06:52AM

Re: Get request_body in set_by_lua directive

maanas April 28, 2013 03:13PM

Re: Get request_body in set_by_lua directive

agentzh April 28, 2013 11:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 254 on July 05, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready