Problem with request body and client_body_in_single_buffer

Hendrik Schumacher hs at activeframe.de
Fri Jul 1 03:48:11 MSD 2011


Hi,

I just had a hard time tracking down the following issue:

I have an apache with mod_perl running behind nginx 0.8.54. In my mod_perl
application decoding large file uploads in multipart/form-data failed. It
seems that the beginning of the request body was repeated (resulting in
one small truncated file and one large corrupt file with no ending
boundary). After deep-debugging my application I disabled nginx and the
upload worked again. So I inspected the nginx settings and commenting out
the following line makes my problem go away:

client_body_in_single_buffer on;

Could it be that nginx somehow doubles the beginning of the request body
if it detects that the client body does not fit in a buffer?

The nginx config also contains the following settings (I left away
path/file configs and other things that are unlikely to provoke this
behaviour):

  proxy_redirect          off;
  proxy_set_header        Host            $host;
  proxy_buffering on;
  proxy_buffer_size 4k;
  proxy_buffers 16 4k;
  proxy_busy_buffers_size 8k;

  default_type application/octet-stream;
  access_log off;
  client_body_in_single_buffer on;
  client_header_buffer_size 4k;#
  client_max_body_size 10m;
  keepalive_timeout 10;
  large_client_header_buffers 4 8k;
  server_tokens off;
  server_names_hash_bucket_size 128; # this seems to be required for some
vhosts


Hendrik




More information about the nginx mailing list