Welcome! Log In Create A New Profile

Advanced

lua_need_request_body ... limitations?

Nginx User
October 21, 2011 11:06AM
So I managed to get my config going smoothly with "GET" requests as
outlined here: http://mailman.nginx.org/pipermail/nginx/2011-October/029901.html
with this correction
http://mailman.nginx.org/pipermail/nginx/2011-October/029903.html

I then decided to extend to cover "POST" requests.

Here is the calling location:

location @proxy_no_cache {
lua_need_request_body on;
access_by_lua_file '/etc/nginx/firewall.lua';
...
proxy_pass http://127.0.0.1:8080;
...
}

firewall.lua contains:

....
-- Check "GET" Args
local args = ngx.req.get_uri_args()
for key, val in pairs(args) do
if type(val) == "table" then
my_arg = table.concat(val, ", ")
else
my_arg = val
end
if my_arg and type( my_arg ) ~= "boolean" then
dofile("/etc/nginx/regex_rules.lua")
end
end

-- Check "POST" Args
local args = ngx.req.get_post_args()
for key, val in pairs(args) do
if type(val) == "table" then
my_arg = table.concat(val, ", ")
else
my_arg = val
end
if my_arg and type( my_arg ) ~= "boolean" then
dofile("/etc/nginx/regex_rules.lua")
end
end
ngx.exit(ngx.OK)

The 'Check "GET" Args' bit works fine but the 'Check "POST" Args' bit
falls over with ...
'lua handler aborted: runtime error: /etc/nginx/firewall.lua:54: no
request body found; maybe you should turn on lua_need_request_body?,
blah, blah, blah'


Question is that, are there limitations on calling
lua_need_request_body on that my set up does not meet?

Thanks.

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

lua_need_request_body ... limitations?

Nginx User October 21, 2011 11:06AM

Re: lua_need_request_body ... limitations?

Nginx User October 21, 2011 11:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 114
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready