nginx client_max_body_size has no effect?
<p>I know this has been asked several times before but I just can't make it work in my config. I'm getting 413 error when trying to upload files larger than the default nginx value of <code>client_max_body_size</code> with is 1 MB.</p>

<p>This are my configs:</p>

<p>nginx.conf:</p>

<pre><code>http {
    client_max_body_size 500M;
    limit_req_status 429;
    limit_conn_status 429;
    limit_req_zone $binary_remote_addr zone=worktoday:40m rate=10r/s;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
</code></pre>

<p>mysite.com:</p>

<pre><code>  server {
      client_max_body_size 500M;
      listen 80;

      location / {
          client_max_body_size 500M;

          proxy_pass http://backend;

          proxy_set_header Host $host;

      }

  }

  upstream backend {
      client_max_body_size 500M;
      least_conn;

      server 172.16.10.10;
      server 172.16.10.12;
  }
</code></pre>

<p>I tried all combinations, putting <code>client_max_body_size</code> in all places (like now), only in some, setting it to 0 (to disable any limit), etc.</p>

<p>I'm desperate to solve this.</p>

<p>Behind nginx there's a flask application running with gunicorn. I already tried the app by itself (without nginx in front) and it works.</p>

<p>I'll really appreciate any help here, thanks.</p>