# Nginx proxying do not locally save/buffer uploaded files?

**URL:** <https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567>\
**Category:** NGINX\
**Created:** [May 4, 2011, 11:16pm UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567 "2011-05-04T23:16:04Z")\
**Posts on this page:** 7\
**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:** [May 4, 2011, 11:16pm UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/1 "2011-05-04T23:16:04Z")

</div>

Hello,

I’m running nginx as a proxy in front of some backend servers,  
and while uploading files (HTTP PUT) nginx seems to buffer the files  
to local disk.

This is not a possible method for this setup,  
because some of the files are so big that they  
won’t fit to the local disk of the nginx box.

Is there an option to disable this behaviour?  
I’d like to directly stream the uploads to the backend…

Thanks,

– Pasi

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [May 4, 2011, 11:36pm UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/2 "2011-05-04T23:36:26Z")

</div>

## Pasi Kärkkäinen Wrote:

> Is there an option to disable this behaviour?  
> I’d like to directly stream the uploads to the  
> backend..

No. Nginx has no way of streaming data directly to the backend. Take a  
look at haproxy or any other tcp load balancer.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,195656,195659#msg-195659](http://forum.nginx.org/read.php?2,195656,195659#msg-195659)

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [May 4, 2011, 11:57pm UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/3 "2011-05-04T23:57:26Z")

</div>

## Pasi Kärkkäinen Wrote:

> in tcp mode you can’t filter the requests etc.. I  
> need to do that aswell.

There are quite a few load balancers and proxies out there. I’m sure you  
can find something useful.

> Maybe I need to take a look at the code and try to  
> figure out  
> if direct upload streaming could be implemented in  
> nginx..

It is possible. So, good luck I guess.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,195656,195665#msg-195665](http://forum.nginx.org/read.php?2,195656,195665#msg-195665)

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [May 5, 2011, 3:23pm UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/4 "2011-05-05T15:23:29Z")

</div>

On Wed, May 04, 2011 at 05:56:43PM -0400, jjjx128 wrote:

> ## Pasi K. Wrote:
> 
> > in tcp mode you can’t filter the requests etc.. I  
> > need to do that aswell.
> 
> There are quite a few load balancers and proxies out there. I’m sure you  
> can find something useful.

I’ve checked and/or used most of them 🙂

> > Maybe I need to take a look at the code and try to  
> > figure out  
> > if direct upload streaming could be implemented in  
> > nginx..
> 
> It is possible. So, good luck I guess.

Thanks. Are you familiar with nginx code?  
If yes, feel free to give advises what to avoid,  
and what to look for.

(I haven’t checked nginx code earlier, but I know C)

– Pasi

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [May 9, 2011, 5:13am UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/5 "2011-05-09T05:13:06Z")

</div>

If we set proxy\_store and proxy\_cache to off, will nginx cache uploaded  
files?

Posted at Nginx Forum:

> **[Re: nginx proxying do not locally save/buffer uploaded files?](https://forum.nginx.org/read.php?2,195656,196629#msg-196629)**
>
> Hello, I'm running nginx as a proxy in front of some backend servers, and while uploading files (HTTP PUT) nginx seems to buffer the files to local disk. This is not a possible method for this setup, because some of the files are so big that they w

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [May 4, 2011, 11:40pm UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/6 "2011-05-04T23:40:46Z")

</div>

On Wed, May 04, 2011 at 05:35:54PM -0400, jjjx128 wrote:

> ## Pasi K. Wrote:
> 
> > Is there an option to disable this behaviour?  
> > I’d like to directly stream the uploads to the  
> > backend..
> 
> No. Nginx has no way of streaming data directly to the backend. Take a  
> look at haproxy or any other tcp load balancer.

in tcp mode you can’t filter the requests etc.. I need to do that  
aswell.

Maybe I need to take a look at the code and try to figure out  
if direct upload streaming could be implemented in nginx..

Thanks,

– Pasi

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [May 9, 2011, 8:34am UTC](https://www.ruby-forum.com/t/nginx-proxying-do-not-locally-save-buffer-uploaded-files/206567/7 "2011-05-09T08:34:23Z")

</div>

On Sun, May 08, 2011 at 11:12:29PM -0400, bigplum wrote:

> If we set proxy\_store and proxy\_cache to off, will nginx cache uploaded  
> files?

proxy\_cache only mentions “backend” .. so I think it’s not for uploads..

– Pasi
