Forum: NGINX why 'client closed prematurely connection while sending request to upstream' ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D26fff640aa38460689b0452cb79d445?d=identicon&s=25 Yu.Cheung (Guest)
on 2009-04-21 05:02
(Received via mailing list)
Hi,
    All.
    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;
    proxy_pass http://10.68.3.23:8390;


    location /pass {
              proxy_pass_request_body on;
        proxy_pass http://10.68.3.23:8388/$fn;
        }

    location /download {
       proxy_pass http://10.68.3.23:8388/$fn;
      }


    }#end of location /

    }#server

  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;

     dav_methods PUT DELETE MKCOL COPY MOVE;

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

                  limit_except GET {
       allow all;
       }
    }

  }#backend server 2


}#http

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

Thanks.
D26fff640aa38460689b0452cb79d445?d=identicon&s=25 Yu.Cheung (Guest)
on 2009-04-21 11:42
(Received via mailing list)
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.  :)


2009/4/21 Yu.Cheung <nkcheungyu@gmail.com>:
This topic is locked and can not be replied to.