Welcome! Log In Create A New Profile

Advanced

Re: Can't upload big files via nginx as reverse proxy

Maxim Dounin
June 05, 2012 03:56AM
Hello!

On Tue, Jun 05, 2012 at 03:33:24AM -0400, speedfirst wrote:

> Hey.
>
> In my env, the layout is:
>
> client <--> nginx <--> jetty
>
> In the client, there is a <input type=file> control. I tried to upload a
> file with size of 3.7MB. In the client request, the content type is
> "multipart/form-data", and there is an "Expect: 100-continue" header.
>
> Through tcpdump, I could see nginx immediately return an "HTTP/1.1 100
> Continue" response, and started to read data. After buffering the
> uploaded data, nginx then started to send them to jetty. However in this
> time, no "Expect: 100-continue" header was proxied because HTTP/1.0 is
> used.

So far this is expected behaviour.

> After sending part of data, nginx stopped continuing to proxy the rest
> of data, but the connection is kept. After 30s, jetty reports time out
> exception and returned an response. Nginx finally proxied this response
> back to client.
>
> I simply merged all the tcp segments which was sent from nginx to jetty,
> and found only 400K bytes are proxied.

This is obviously not expected.

Anything in error log? Could you please provide tcpdump and debug
log? It would be also cool to see which version of nginx you are
using, i.e. please provide "nginx -V" output, and a full config.

>
>
> My nginx config is quite simple, just
>
> server {
> listen 80;
> location / {
> proxy_pass http://upstream;
> }
> }

This misses at least "client_max_body_size" as by default 3.5MB
upload will be just rejected.

>
> All proxy buffer config was not explicitly set so the default values
> were applied. I tried to "proxy_buffering off;" and re-do the experiment
> above and find the result was same.

Proxy buffers, as well as proxy_buffering, doesn't matter, as it
only affects sending response from an upstream to a client.

> I also tried to observe the temp file written by nginx but it's
> automatically removed when everything is done. Any way to keep it?

client_body_in_file_only on;

See here for details:
http://nginx.org/r/client_body_in_file_only

Maxim Dounin

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

Can't upload big files via nginx as reverse proxy

speedfirst June 05, 2012 03:33AM

Re: Can't upload big files via nginx as reverse proxy

speedfirst June 05, 2012 03:39AM

Re: Can't upload big files via nginx as reverse proxy

Maxim Dounin June 05, 2012 03:56AM

Re: Can't upload big files via nginx as reverse proxy

speedfirst June 05, 2012 05:24AM

Re: Can't upload big files via nginx as reverse proxy

speedfirst June 05, 2012 06:08AM

Re: Can't upload big files via nginx as reverse proxy

Maxim Dounin June 05, 2012 06:48AM

Re: Can't upload big files via nginx as reverse proxy

speedfirst June 05, 2012 07:26AM

Re: Can't upload big files via nginx as reverse proxy

fcaoliveira March 24, 2014 02:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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