# Upload issue when NGINX actes as reverse proxy

**URL:** <https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693>\
**Category:** NGINX\
**Created:** [February 25, 2011, 7:38am UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693 "2011-02-25T07:38:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 25, 2011, 7:38am UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/1 "2011-02-25T07:38:01Z")

</div>

Hi all:

I met an issue when I use NGINX.

When NGINX works as reverse proxy, I try to upload about 300M file to  
the  
backend webserver, I failed.

1. I change the entry “client\_max\_body\_size 300m” in nginx.conf, but I  
still  
fail.

2. It seems that the file is cached by nginx,then re-transmit to  
backend.  
If I want to upload 1GB size file and there is no enough memory in  
reverse-server, it is fail also?

3. can we set bypass the file uploading ?

anyone can give me some help?

thanks  
George

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 8:08am UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/2 "2011-02-25T08:08:08Z")

</div>

Web G. at 2011-2-25 14:36 wrote:

> Hi all:
> 
> I met an issue when I use NGINX.
> 
> When NGINX works as reverse proxy, I try to upload about 300M file to  
> the backend webserver, I failed.
> 
> 1. I change the entry “client\_max\_body\_size 300m” in nginx.conf, but I  
> still fail.  
> What’s the error.log show?
> 2. It seems that the file is cached by nginx,then re-transmit to backend.  
> If I want to upload 1GB size file and there is no enough memory in  
> reverse-server, it is fail also?  
> No, If there is not enough memory, Nginx will save it to a temporary  
> file in the disk. After file uploading completed, Then it will send this  
> static temporary file to backend.  
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
Weibin Y.

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 10:21am UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/3 "2011-02-25T10:21:01Z")

</div>

Thanks Weibin’s feedback.

I searched a mail with the same issue.  
ref: [http://forum.nginx.org/read.php?2,5506,146254](http://forum.nginx.org/read.php?2,5506,146254)

> From the update of Igor, it should be an issue and would be developed.

We do not know the latest status…

It seems that UPLOAD module can not solve the issue.

Anyone has a good method for the issue?

thanks  
George

2011/2/25 Weibin Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 4:54pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/4 "2011-02-25T16:54:39Z")

</div>

----- Valery K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > It seems that UPLOAD module can not solve the issue.
> 
> No, it doesn’t seem so. upload module is especially designed for solving this  
> issue.

Correction: yes, you are right and I am wrong, as long as you are  
talking about streaming uploads to the backend.

However, if you want to stream the entire request body without  
modifications, why don’t you make clients send requests directly to the  
backend?

–  
Regards,  
Valery K.

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 6:32pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/5 "2011-02-25T18:32:19Z")

</div>

thanks for your info.

Can NGINX bypass and sent it directly to backend ?

thanks  
George

2011/2/25 Valery K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 4:45pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/6 "2011-02-25T16:45:15Z")

</div>

----- Web G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks Weibin’s feedback.
> 
> I searched a mail with the same issue.  
> ref: [http://forum.nginx.org/read.php?2,5506,146254](http://forum.nginx.org/read.php?2,5506,146254)
> 
> > From the update of Igor, it should be an issue and would be developed.
> 
> We do not know the latest status…
> 
> It seems that UPLOAD module can not solve the issue.

No, it doesn’t seem so. upload module is especially designed for solving  
this issue.

–  
Regards,  
Valery K.

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 6:58pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/7 "2011-02-25T18:58:02Z")

</div>

Web G. wrote:

> thanks for your info.
> 
> Can NGINX bypass and sent it directly to backend ?

It can, but without streaming (with buffering), which is now what you  
want as we have already figured out.

> ```
> >
> > > We do not know the latest status...
> modifications, why don't you make clients send requests directly to
> 
> ```

–  
Best regards,  
Valery K.

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 6:34pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/8 "2011-02-25T18:34:51Z")

</div>

Do anyone meet the same issue Is there a workaround?

How does it solve the issue?  
If NGINX works as reverse proxy, it seems the issue is easy to  
reproduce. ?

thanks  
George

2011/2/25 Web G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 27, 2011, 5:31pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/9 "2011-02-27T17:31:51Z")

</div>

Do you mean that it is the configuration issue because of backend server  
?  
I set the “buffing off”.

2011/2/25 Mark M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 28, 2011, 7:29pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/10 "2011-02-28T19:29:40Z")

</div>

On Sun, Feb 27, 2011 at 8:30 AM, Web G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > > thanks for your info.
> > > > 
> > > > > > 
> > > > > 
> > > > > No, it doesn’t seem so. upload module is especially designed for  
> > > > > Regards,  
> > > > > file. In that case, it was just a matter of upping Apache’s timeout.  
> > > > > In my case, yes. I usually have the upload buffer set to a couple  
> > > > > hundred meg and slower clients wouldn’t hit either the end of the  
> > > > > upload or the buffer limit before Apache had timed out the connection  
> > > > > from nginx. If you’re not buffering though, then probably not relevant  
> > > > > to your issue.

---

<div class="post-metadata">

**Author:** ![Web\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e9a140/32.png) [@Web\_G](https://www.ruby-forum.com/u/Web_G)\
**Post date:** [February 25, 2011, 7:35pm UTC](https://www.ruby-forum.com/t/upload-issue-when-nginx-actes-as-reverse-proxy/203693/11 "2011-02-25T19:35:02Z")

</div>

On Fri, Feb 25, 2011 at 9:56 AM, Valery K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > thanks  
> > [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:
> > 
> > > > It seems that UPLOAD module can not solve the issue.
> > 
> > –  
> > Regards,  
> > Valery K.
> > 
> > * * *
> > 
> > nginx mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

When I’ve run into this type of issue, usually it’s due to the backend  
(Apache in my case) not seeing any activity over the connection that  
nginx has made with it, while nginx is buffering the upload to a temp  
file. In that case, it was just a matter of upping Apache’s timeout.
