Getting status 400 from nginx when submitting a form with multiple file fields

I use rails 4.2 and nginx in my production. I have a form with several file fields. Until yesterday, this functionality worked as expected. But a strange problem has just arrived.

Problem: When submitting this form, it loads. I checked the nginx error log, found nothing. By checking the access log, I got 400 status for this request after shutting down.

I checked by disabling the file fields. If in this form one file field is active, then it works. But when activating more than one file field, such an error occurred.

000.11.221.162 - - [19/Aug/2016:11:41:16 +0000] "POST /categories HTTP/1.1" 400 0 "http://someapp.com/categories/new" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"

Has anyone encountered this type of problem. Any suggestion would be helpful.

Nginx configuration

http{
    passenger_root /usr/local/rvm/gems/ruby-2.1.0@global/gems/passenger-5.0.21;
    passenger_ruby /usr/local/rvm/gems/ruby-2.1.0/wrappers/ruby;

    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
            listen                80;
            server_name           xxx.xxx.xxx.xx;
            passenger_enabled     on;
            root                  /path/to/rails/public;
            rails_env             production;
            client_max_body_size    0;
            client_body_timeout     600s;
            send_timeout            600s;
        }
}
+4

Source: https://habr.com/ru/post/1651781/


All Articles