title: How to limit the max chunk size for chunked_transfer_encoding in nginx?
body: <h3>What I'm trying to do</h3>
  <p>I'm trying to limit the chunk size, as in, the maximum size a response body can have for an nginx v1.19.7.</p>
  <h3>What I tried</h3>
  <p>I found various parameters that do similar things in the <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size" rel="nofollow noreferrer">nginx docs</a>, among them <code>client_body_buffer_size</code>.</p>
  <blockquote>
  <p>Sets buffer size for reading client request body. In case the request body is larger than the buffer, the whole body or only its part is written to a temporary file. By default, buffer size is equal to two memory pages. This is 8K on x86, other 32-bit platforms, and x86-64. It is usually 16K on other 64-bit platforms.</p>
  </blockquote>
  <p>Which does not sound like it's limiting the size of response chunks, but rather how buffer size for incoming packages with any kind chunk size.</p>
  <p>Similarly i can configure: <code>chunked_transfer_encoding</code> which the docs say is</p>
  <blockquote>
  <p>Allows disabling chunked transfer encoding in HTTP/1.1. It may come in handy when using a software failing to support chunked encoding despite the standard’s requirement.</p>
  </blockquote>
  <p>This sounds like it's disabling the chunked transfer, but I have not found the configuration option to limit the chunk size for the chunked transfer.</p>
  <p>Which parameter am I missing?</p>
  <p><strong>Edit:</strong></p>
  <p><a href="http://nginx.org/en/docs/http/ngx_http_v2_module.html" rel="nofollow noreferrer">I found the HTTP/2 parameter <code>http2_chunk_size</code></a> but I'm unsure if it's related.</p>
  <blockquote>
  <p>Sets the maximum size of chunks into which the response body is sliced. A too low value results in higher overhead. A too high value impairs prioritization due to HOL blocking.</p>
  </blockquote>
  <p>it sounds like it, but I'm not sure. It was added in v1.9.5.</p>