Buffer messages in log even with buffering turned off

Howdy folks,

We’ve been seeing some recurring logs in our log that look like this:

2013/01/28 18:30:36 [warn] 2657#0: *210608 a client request body is
buffered to a temporary file /var/cache/nginx/client_temp/0000000772,
client: , server: , request: “POST
/upload/publish_thumbnail HTTP/1.1”, host: “”

Based on searching through the mailing list’s previous questions we
found
that we could set the following directives in order to attempt to
disable
it:

client_max_body_size 0;
proxy_max_temp_file_size 0;

At first we only had this in the ‘http’ context but then also copied
those
same configurations into the ‘server’ and ‘location’ contexts to see if
that would help since the messages continued to appear in the log. Even
after adding it to ‘server’ and ‘location’, the messages continue - is
there another configuration directive that we might be missing? Our
config
is pretty simple and and doesn’t have any location or server contexts
that
I could have missed (also verified that the context that this message
appears under is covered by the two directives that we set to 0).

Thanks in advance,
Chris.

On Mon, Jan 28, 2013 at 10:37:51AM -0800, Christopher Opena wrote:

Hi there,

We’ve been seeing some recurring logs in our log that look like this:

2013/01/28 18:30:36 [warn] 2657#0: *210608 a client request body is
buffered to a temporary file /var/cache/nginx/client_temp/0000000772,
client: , server: , request: “POST
/upload/publish_thumbnail HTTP/1.1”, host: “”

Based on searching through the mailing list’s previous questions we found
that we could set the following directives in order to attempt to disable
it:

If you want to ensure that the client request body is not buffered to
disk, you want to make sure that your client_body_buffer_size is larger
than your client_max_body_size. And be willing to refuse any client
request body bigger than that.

client_max_body_size 0;

http://nginx.org/r/client_max_body_size

Sets the maximum allowed size of the client request body. Setting size
to 0 disables client request body size checking.

proxy_max_temp_file_size 0;

http://nginx.org/r/proxy_max_temp_file_size

For responses from the proxied server.

Look at Module ngx_http_core_module

You probably want directives which start “client_body_”.

f

Francis D. [email protected]

On Mon, Jan 28, 2013 at 10:58 AM, Francis D. [email protected]
wrote:

Sets the maximum allowed size of the client request body. Setting size

You probably want directives which start “client_body_”.

Thanks for the rapid reply, Francis. So it seems that even if we
disable
client request body size checking altogether (setting to 0), we still
have
to set all the other client_body_ checks? The primary aim is to just
let
Nginx pass through any traffic regardless of size because we are mostly
using Nginx as a proxy / pass-through / load-balancing mechanism doing a
hand-off to Apache until we can finally get our app off Apache and fully
convert to Nginx.

On Mon, Jan 28, 2013 at 11:25:12AM -0800, Christopher Opena wrote:

On Mon, Jan 28, 2013 at 10:58 AM, Francis D. [email protected] wrote:

If you want to ensure that the client request body is not buffered to
disk, you want to make sure that your client_body_buffer_size is larger
than your client_max_body_size. And be willing to refuse any client
request body bigger than that.

Thanks for the rapid reply, Francis. So it seems that even if we disable
client request body size checking altogether (setting to 0), we still have
to set all the other client_body_ checks?

The only client body checks are client_max_body_size and
client_body_timeout. The other client_body_* directives are (mostly)
independent of those.

When the client sends something to nginx, nginx buffers it somewhere
before sending it upstream. That “somewhere” can be disk or ram.

If it is bigger than your configured client_body_buffer_size, it goes
to disk, and lets you know that that happened.

The primary aim is to just let
Nginx pass through any traffic regardless of size because we are mostly
using Nginx as a proxy / pass-through / load-balancing mechanism doing a
hand-off to Apache until we can finally get our app off Apache and fully
convert to Nginx.

That’s what nginx does. Except that it buffers input before sending
upstream. Occasional buffering to disk isn’t a bad thing.

f

Francis D. [email protected]