title: Rails, Nginx, Puma: Rack app error: RegexpError: failed to allocate memory when uploading large file
body: <p>I get error <code>Rack app error: #&lt;RegexpError: failed to allocate memory: /\A[^%]*(?:%\h\h[^%]*)*\z/&gt;</code> when I try to upload 25.5mb file. File uploads as base64 encoded data. This error appears in Puma logs. </p>
  
  <p>nginx config:</p>
  
  <pre><code>upstream tgmu {
    server unix:///home/railsuser/eis/shared/tmp/sockets/puma.sock;
  }
  
  server {
    listen 80;
    client_max_body_size 100m;
    root /home/railsuser/eis/current/public;
  
    server_name xxx;
  
    location / {
      proxy_pass http://tgmu;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }
  </code></pre>
  
  <p>How to fix that?</p>