Why 'client closed prematurely connection while sending request to upstream'?

I want to proxy twice. but there was something wrong with it.

what I want to do:

client send request----->nginx server------->sending(proxy_pass)

its header to the backend server 1 ---->back to ngx server---->proxy
pass to the second backend server---->back to ngx server---->response
to client.

but when the request was sent to backend server 1, 'the client

closed prematurely connection while sending request to upstream’ came,
all of my http servsers are Nginx.

the simple conf (just use virtual 3 servers) is:

http {
include mime.types;
default_type text/html;
expires -1;

sendfile on;

client_max_body_size 10000m;

server {

server_name front;
listen 8389;

location / {

if ($uri ~ "/(.*)") {
  set $fn $1;

proxy_ignore_client_abort on;

proxy_pass_request_body off;

location /pass {
          proxy_pass_request_body on;

location /download {

}#end of location /


server {

server_name transfer;
listen 8390;
proxy_ignore_client_abort  on;

location / {
       set $loc "/pass";
 add_header "X-Accel-Redirect" $loc;
 return 301;

}#backend server 1

server {
server_name storage;
listen 8388;

location / {
            root /data;
 client_body_temp_path /data1/client_tmp;


 create_full_put_path on;
 dav_access user:rw group:rw all:rw;

              limit_except GET {
   allow all;

}#backend server 2


when i put one file to test, while sending to the first upstream
server(backend 1), the connection closed.
why ?


it seems because the body size does not match the size
"Content-Length: " defined.
when the content-length is the body’s size, it will be ok.
but i tried the wrong length in the request header, the ‘client closed
…’ came… [ I just want to make sure whether it will work in this
way, for security ]
I am not sure about this.
but this working way is what i need. :slight_smile:

2009/4/21 Yu.Cheung [email protected]: