Welcome! Log In Create A New Profile

Advanced

Can't upload big files via nginx as reverse proxy

June 05, 2012 03:33AM
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.

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.


My nginx config is quite simple, just

server {
listen 80;
location / {
proxy_pass http://upstream;
}
}

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.

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?


Therefore, I'm wondering is this expected? Did I make mistakes for configuring proxy buffers? Do I have to use the third party "upload" module (http://www.grid.net.ru/nginx/upload.en.html) to make it work?

Many thanks.
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: 183
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