Welcome! Log In Create A New Profile

Advanced

Using nginx upload module and nginx lua together

myxingkong
February 05, 2020 04:38AM
I am using nginx upload module for uplaoding files to server. But I wanted nginx to upload to different paths, not to a path mentioned in upload_store. So I am taking help of nginx-lua module to change the upload_store value on each request like below.


location /umtest {
upload_pass /nginx_response;
set $upload_store '';
rewrite_by_lua '
local header = ngx.req.raw_header()
ngx.say("type header",header)
dst_path_dir = ngx.req.get_headers()["Dst-Dir"]
ngx.say("dst_path_dir",dst_path_dir)
ngx.var.upload_store = dst_path_dir
ngx.say("upload store path" ,ngx.var.upload_store)
';
upload_set_form_field $upload_field_name.name
"$upload_file_name";
upload_set_form_field $upload_field_name.content_type
"$upload_content_type";
upload_set_form_field $upload_field_name.path
"$upload_tmp_path"
upload_cleanup 400 404 499 500-505;
}


Now when I POST to the '/umtest' it will change the upload_store value, but it will not execute the nginx upload direcives (i.e., upload will not happen). When I comment the rewrite_by_lua directive , the upload happens. My question is cant we use both at a same time to achieve the purpose?_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using nginx upload module and nginx lua together

myxingkong February 05, 2020 04:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 197
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready