Git push fails - client intended to send too large chunked body
Symptoms
With an nginx (nginx version 1.4.7 which includes built-in chunking support) front end, attempting to push to Stash over HTTP/S fails with the following error (SSH works without issue):
2014/04/17 11:09:27 [error] 448#0: *334 client intended to send too large chunked body: 1032429+16372 bytes, client: 192.168.152.129, server: stash.bturner.com,
request: "POST /scm/qa/test-huge.git/git-receive-pack HTTP/1.1", host: "stash.bturner.com"
2014/04/17 11:13:43 [error] 599#0: *341 client intended to send too large chunked body: 1032429+16372 bytes, client: 192.168.152.129, server: stash.bturner.com,
request: "POST /scm/qa/test-huge.git/git-receive-pack HTTP/1.1", host: "stash.bturner.com"
2014/04/17 11:15:19 [error] 630#0: *348 client intended to send too large chunked body: 1073733869+8192 bytes, client: 192.168.152.129, server: stash.bturner.com,
request: "POST /scm/qa/test-huge.git/git-receive-pack HTTP/1.1", host: "stash.bturner.com"
Diagnosis
Without the client_max_body_size
on the 443 server entry, pushing dies basically immediately for anything not trivially-sized because the default limit of 1M is applied. By setting client_max_body_size 1024m;
on 443, pushing a 650MB repository succeeds. Pushing a 1.2GB repository fails with the final failure in the output above, where nginx complains about the the data being over 1GB.
Resolution
Setting client_max_body_size 0;
allows users to push repositories of any size.
Final configuration:
client_body_buffer_size 128k;
client_max_body_size 0;
ignore_invalid_headers off;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;
proxy_connect_timeout 60;
proxy_intercept_errors on;
proxy_next_upstream error timeout;
proxy_redirect off;
proxy_send_timeout 90;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_temp_file_write_size 64k;
ssl on;
ssl_certificate /etc/nginx/ssl/stash.bturner.com.crt;
ssl_certificate_key /etc/nginx/ssl/stash.bturner.com.key;
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!EXP-RC4-MD5:!aNULL:!kEDH;
ssl_prefer_server_ciphers on;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:TLSSL:16m;
ssl_session_timeout 10m;