Welcome! Log In Create A New Profile

Advanced

Re: forward arguments in upload module

Francis Daly
June 11, 2011 04:48AM
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
--
Francis Daly francis@daoine.org

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

forward arguments in upload module

vetri June 10, 2011 09:58AM

Re: forward arguments in upload module

Alexander Kunz June 10, 2011 10:52AM

Re: forward arguments in upload module

vetri June 11, 2011 12:40AM

Re: forward arguments in upload module

Francis Daly June 11, 2011 04:48AM

Re: forward arguments in upload module

vetri June 13, 2011 02:12AM

Re: forward arguments in upload module

Francis Daly June 13, 2011 02:22PM

Re: forward arguments in upload module

vetri June 14, 2011 02:07AM

Re: forward arguments in upload module

Francis Daly June 14, 2011 01:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 217
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