nginx is eating my client request - multipart/form-data file upload

Jason H jhihn at gmx.com
Mon Dec 15 15:21:07 UTC 2014


As requested. 100k debug log attached. I didn't see anything obviously wrong in the log.

Thanks for your help.
 
nginx -V: --------------------------------
nginx version: nginx/1.6.2
built by gcc 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=' -Wl,-E'
----------------end output

nginx.conf:------------------------------
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log  info;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    include /etc/nginx/conf.d/*.conf;
    index   index.html index.htm;
# issue testing
client_max_body_size 2m;
client_body_in_file_only on;
client_body_in_single_buffer on;
client_body_buffer_size 1m;
# end issue testing

    server {
        listen       80;
        server_name  dev.tissue-analytics.com localhost;
        root         /usr/share/nginx/html;
        location / {
	    root /data/www;
        }
        location /dyn {
	    proxy_pass	http://127.0.0.1:1337;
        }
        location /debug {
	    proxy_pass	http://127.0.0.1:1338;
        }
        error_page  404              /404.html;
        location = /40x.html {
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        }
    }
}
------------------ end conf



> Sent: Monday, December 15, 2014 at 7:52 AM
> From: "Maxim Dounin" <mdounin at mdounin.ru>
> To: nginx at nginx.org
> Subject: Re: nginx is eating my client request - multipart/form-data file upload
>
> Hello!
> 
> On Sun, Dec 14, 2014 at 04:43:51PM +0100, Jason H wrote:
> 
> > I am new to nginx, but am familar with low-level HTTP and 
> > apache. When I try to do a multipart/form file upload, nginx 
> > writes some of the client request body to disk, but never 
> > finishes and it never passes it to the down/upstream script.
> > 
> > My specific setup is I have nginx with /dyn redirected to 
> > localhost:1337, where a node.js instance is listening. It 
> > works... except for the file upload handler. Also in the config 
> > is a /debug which is redirected to localhost:1338, which goes to 
> > a simple socket dump server for viewing the post.
> > 
> > I changed the error log handling to 'info'. It reports storing 
> > the client body to a file and when I examine it, it is almost as 
> > I expected:
> > 
> > --boundary_.oOo._MjM5NzEwOTkxMzU2MjA0NjM5MTQxNDA3MjYwOA==
> > Content-Type: image/jpeg
> > Content-Disposition: form-data; name="file"; 
> > filename="dccde7b5-25aa-4bb2-96a6-81e9358f2252.jpg"
> > 
> > <binary data, supposed to be ~89k>
> > 
> > The problem with this file is too short, only 81,920 bytes (only 
> > 80k, exactly) when the file is 88,963 bytes, it should be 88,963 
> > + the header above.... But that is literally only half of it. 
> 
> [...]
> 
> Could you please provide "nginx -V" output, full config, and a 
> debugging log for a request which demonstrates the problem?
> 
> See http://wiki.nginx.org/Debugging for some hints.
> 
> -- 
> Maxim Dounin
> http://nginx.org/
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug.log
Type: text/x-log
Size: 105925 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141215/7dd02cf7/attachment-0001.bin>


More information about the nginx mailing list