# Upstream response is buffered to a temporary file

**URL:** <https://www.ruby-forum.com/t/upstream-response-is-buffered-to-a-temporary-file/217793>\
**Category:** NGINX\
**Created:** [March 13, 2012, 2:37pm UTC](https://www.ruby-forum.com/t/upstream-response-is-buffered-to-a-temporary-file/217793 "2012-03-13T14:37:02Z")\
**Posts on this page:** 4\
**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:** [March 13, 2012, 2:37pm UTC](https://www.ruby-forum.com/t/upstream-response-is-buffered-to-a-temporary-file/217793/1 "2012-03-13T14:37:02Z")

</div>

I installed nginx with the defaults. I’m using it as a reverse proxy,  
but  
not caching. However, I keep getting a lot of entries in the log file  
saying that an “upstream response is buffered to a temporary file”. Is  
there a way to turn this off? Will nginx clean out the cache, or do I  
have  
to do it manually?

Thanks.

---

<div class="post-metadata">

**Author:** ![Bai\_Shen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@Bai\_Shen](https://www.ruby-forum.com/u/Bai_Shen)\
**Post date:** [March 14, 2012, 12:50am UTC](https://www.ruby-forum.com/t/upstream-response-is-buffered-to-a-temporary-file/217793/2 "2012-03-14T00:50:16Z")

</div>

On Tue, Mar 13, 2012 at 09:36:14AM -0400, Bai Shen wrote:

Hi there,

> I installed nginx with the defaults. I’m using it as a reverse proxy, but  
> not caching. However, I keep getting a lot of entries in the log file  
> saying that an “upstream response is buffered to a temporary file”. Is  
> there a way to turn this off?

If your upstream is from a proxy\_pass directive, have a look at  
[Module ngx\_http\_proxy\_module](http://www.nginx.org/r/proxy_buffering) and linked content.

> Will nginx clean out the cache, or do I have  
> to do it manually?

This is a buffer, not a cache, and (I believe) you shouldn’t have to do  
anything manually about it.

All the best,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Bai\_Shen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@Bai\_Shen](https://www.ruby-forum.com/u/Bai_Shen)\
**Post date:** [March 14, 2012, 1:53pm UTC](https://www.ruby-forum.com/t/upstream-response-is-buffered-to-a-temporary-file/217793/3 "2012-03-14T13:53:21Z")

</div>

Is there a reason to have it on?

Is there any recommended settings?

---

<div class="post-metadata">

**Author:** ![Bai\_Shen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@Bai\_Shen](https://www.ruby-forum.com/u/Bai_Shen)\
**Post date:** [March 14, 2012, 3:57pm UTC](https://www.ruby-forum.com/t/upstream-response-is-buffered-to-a-temporary-file/217793/4 "2012-03-14T15:57:12Z")

</div>

Hello!

On Wed, Mar 14, 2012 at 08:52:50AM -0400, Bai Shen wrote:

> Is there a reason to have it on?

Yes, the default “proxy\_buffering on” is appropriate for most  
cases. It ensures minimal processing overhead and takes slow  
clients off your upstream servers (which are in many cases  
process-based and can’t handle many connections).

The “proxy\_buffering off” is only appropriate in specific  
situations like long-running connections where you send small  
chunks of data periodically and need them to be immediately  
delivered to client(s).

> Is there any recommended settings?

The default is good enough. If it doesn’t fit you needs, you may  
consider tuning proxy\_buffers and/or proxy\_max\_temp\_file\_size.

If you don’t want to hit disk in any case, you may use

```
proxy_max_temp_file_size 0;

```

which disables disk buffering completely. Note that for obvious  
reasons it will limit nginx ability to offload slow clients from  
your backends.

Maxim D.

> > > saying that an “upstream response is buffered to a temporary file”. Is
