title: Always send Content-Length in Apache?
body: <p>I'm loading a particularly large JSON string that is dynamically generated by PHP. To provide some feedback to the user, I want to show download progress.</p>
  
  <p>I have the code figured out, and it works fine for static content such as images, JS files, etc. However, it doesn't seem to work for dynamic files.</p>
  
  <p>This makes sense, since the dynamic files don't have predictable content length, but even if I add this in PHP:</p>
  
  <pre class="lang-php prettyprint-override"><code>ob_start(function($c) {
      header("Content-Length: ".strlen($c));
      return $c;
  });
  </code></pre>
  
  <p>It still does not send the header (but if I add any other header it works fine).</p>
  
  <p>Is there any way to force Apache to send the <code>Content-Length</code> header? Currently my only alternative is to save the output to a temporary file and redirect to it instead. This would work, but it's kind of messy so I'd rather avoid it if possible.</p>