Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

Re: Get request_body in set_by_lua directive

$
0
0
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

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>