Nginx Lua modifying / setting post request data

119 views
Skip to first unread message

c0nw...@googlemail.com

unread,
Dec 14, 2018, 9:18:15 PM12/14/18
to openresty-en
So here is my code that causes issues with my form.

It seems to be the method I am setting the POST data. Everything else works fine but replacing the existing POST data with my `args` table causes form saving errors and if i remove ngx encode args it causes Lua errors. I seem to be stuck in a rock and a hard place I don't know how else to set the post data setting the un-needed args to nil can anyone see and show me what I am doing wrong please thank you so much <3.


--[[Lua Table POST Request arguments Guest users filter]]
ngx
.req.read_body()
local args = ngx.req.get_post_args() or ""

   
if args["task"] == "get.like"
   
then
        args
["id"] = nil
        args
["task"] = "get.like" --because all have same response
   
end

    ngx
.req.set_body_data(ngx.encode_args(args)) --set the post data as our modified post data (causing errors....!?)

ngx
.var.cache_request_body = ngx.var.request_body --For fastcgi and proxy cache KEY to cache post requests
--[[End Lua Table POST Request arguments Guest users filter]]


bmoul...@gmail.com

unread,
Dec 14, 2018, 10:10:26 PM12/14/18
to openre...@googlegroups.com
BitBounce
     
     

Hello! I use a new email filtering service called BitBounce to filter my email. To deliver your email to my inbox, please click the button below and pay the small cryptocurrency fee. Thank you!

$0.05 to deliver your email.

We’ve never met — I’ll pay your fee.

I know you — Add me to your whitelist.

     
     

BitBounce is powered by
 the Credo cryptocurrency

I’m from a business — 
what are my delivery options

BitBounce and Credo are
transacted through CredoEx

Made by Turing Technology Inc. in San Mateo, California Sign Up for BitBounce
Reply all
Reply to author
Forward
0 new messages