atom feed8 messages in ru.sysoev.nginxRe: forward arguments in upload module
FromSent OnAttachments
vetriJun 10, 2011 6:58 am 
Alexander KunzJun 10, 2011 7:50 am 
vetriJun 10, 2011 9:40 pm 
Francis DalyJun 11, 2011 1:46 am 
vetriJun 12, 2011 11:11 pm 
Francis DalyJun 13, 2011 11:20 am 
vetriJun 13, 2011 11:07 pm 
Francis DalyJun 14, 2011 10:30 am 
Subject:Re: forward arguments in upload module
From:Francis Daly (fran@daoine.org)
Date:Jun 11, 2011 1:46:20 am
List:ru.sysoev.nginx

On Sat, Jun 11, 2011 at 12:40:36AM -0400, vetri wrote:

Hi there,

i am sending query arguments in post operation which will be passed to backend server.

Thanks for the reply . i am not using form to upload files. i am using java client to send files to nginx via post operation.

So your java client is doing roughly the same thing as

curl -v -F f=@testfile -F submit=on -F k=v http://localhost:8085/zsupload

where "k=v" is your query arguments. Is that correct?

If you test using that tool, you'll be able to get the nginx config right first; then you can change the client as needed to make sure it fits.

i want to append one more key value pair to that query arguments to send into backend server(own key value will be taken from program)

If you want your program to send the extra k1=v1, then you just do it the same way as you set the original k=v -- one more "-F k1=v1" in the curl command line, and whatever you did in your java client for the live solution.

If you want nginx to create the extra k1=v1 in between getting from the client and sending to the backend, then you configure it as was suggested.

See below.

even though i tried what u said there is no notification at the backend .here is the config

# Set specified fields in request body 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";

Here, adding

upload_set_form_field k1 v1;

will add that key/value pair to the request sent to the backend. You can replace either of the k1/v1 strings with nginx variables that have been set, just like the three previous lines.

That is for "nginx creates the extra k1/v1".

upload_pass_form_field "^submit$|^description$";

That setting is a regex which determines which of the keys sent by the original client will be copied into the request sent to the backend.

So if you want the client to send k1/v1 and have it sent to the backend, then you'll have to modify the above line to include matching "k1".

Good luck,

f