Nginx lua - rewrite url, forward original POST data/multipart form data -


nginx lua extension makes easy examine , manipulate request prior having dispatched appropriate. in current project trapping requests arrive @ specified folder location, examining request , having executed entirely different script. out line of do

/etc/nginx/sites-available/default configuration

location /myfolder{  rewrite_by_lua_file "/path/to/rewrite.lua";  lua_need_request_body "on"; } 

in rewrite.lua

ngx.req.set_header('special','my_special-header');   local data = ngx.req.get_body_data(); ngx.req.set_body_data(data); 

and redirecting location

ngx.req.set_uri("/myother/index.php",true); 

with simple requests or post requests 1 or 2 items of attached post data works well. issue have been unable resolve this. instance sending out multipart data in original request.

ngx.req.get_body_data() 

actually gets raw request body. if forward /myother/index.php can retrieve file_get_contents('php://input'). ok not enough. don't want have deal raw input here. rather able work standard php $_post , $_files variables. however, empty , contents present in body text string.

is there way tell nginx when subject user request treatment lua prior forawarding url should pass on post/put request fields whole of original $_files array?

i'd appreciate help


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -