Welcome! Log In Create A New Profile

Advanced

Re: Clientbodyinfileonly - POST request is discarded

October 07, 2016 03:47PM
Hi Francis,
I added return statement to my config as you suggested. Now config for backend s2 looks like:

server {
listen 8080;
server_name s2;

location / {
root /usr/share/nginx/html/foo/bar;
return 200 "Do something sensible with $http_x_file\n";
autoindex on;
}
}

Unfortunately still it doesn't work as I expect - upload.txt file content is not saved on server side in /tmp/nginx-client-body.

My understanding is that transfer should be performed in 2 phases (2 POST requests via 2x curl). First request should deliver file name, and second should deliver actual file content without ingeration from backend side. I analyzed HTTP flow in wireshark and it looks fine for me (details below).

1. curl --data-binary upload.txt http://localhost/upload

- s1 listening on 80 recive POST request with body = "upload.txt". S1 buffer "upload.txt" in /tmp/0000001, generate new POST request with field X-FILE="/tmp/0000001" and pass this request to backend (s2)
- s2 listening on 8080 recieve POST request with X-FILE = "/tmp/0000001"
- s2 generate HTTP response 200 with body = "Do something sensible with /tmp/0000001\n" and pass it to s1
- s1 recieve above response and pass it to client
- client recieve HTTP response 200 with body = "Do something sensible with /tmp/0000001\n"

2. curl --data-binary '@upload.txt' http://localhost/upload

If I understand this mechanism correctly now actual upload.txt transfer to server without backend ingeration should be triggered.
So I should get reponse 200 and upload.txt content should be saved by server under /tmp/nginx-client-body.
Anyway when I type curl --data-binary '@upload.txt' http://localhost/upload whole scenario from previous point is performed again.
Subject Author Posted

Clientbodyinfileonly - POST request is discarded

yurai October 04, 2016 03:28PM

Re: Clientbodyinfileonly - POST request is discarded

Francis Daly October 04, 2016 03:48PM

Re: Clientbodyinfileonly - POST request is discarded

yurai October 07, 2016 03:47PM

Re: Clientbodyinfileonly - POST request is discarded

Francis Daly October 09, 2016 12:06PM

Re: Clientbodyinfileonly - POST request is discarded

yurai October 10, 2016 03:41AM

Re: Clientbodyinfileonly - POST request is discarded

Francis Daly October 10, 2016 12:18PM

Re: Clientbodyinfileonly - POST request is discarded

yurai October 12, 2016 06:28AM

Re: Clientbodyinfileonly - POST request is discarded

Francis Daly October 12, 2016 12:04PM

Re: Clientbodyinfileonly - POST request is discarded

yurai October 12, 2016 03:34PM

Re: Clientbodyinfileonly - POST request is discarded

Francis Daly October 12, 2016 05:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 101
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready