How to disable Transfer-Encoding: chunked in Apache with HTTP/1.1 responses

apache-2.2chunkedencoding

I have a mod_include (SSI) page that is generating erronous output during chunked encoding when requested by a HTTP/1.1 browser.

The page is output fine when requested by a HTTP/1.0 (because the output is not chunked).

How can I tell Apache not to use chunked encoding when requested by a HTTP/1.1 browser?

More info: The erronous chunked output is caused by having sendfile() support enabled on a Solaris 5.10 machine with a sparc processor. Disabling sendfile() support causes this problem to disappear; however I am trying to catch this bug and fix it.

Best Answer

If you pre-specify Content-length, Apache won't have to use chunked. Without Content-length, Apache has no option but to use it.

To be clear: HTTP/1.0 manages it because Apache reads in the entire response before sending it along, so it know how large it'll be. This is hilariously inefficient, and slow, and AFAIK there's no way to enable this logic for HTTP/1.1 requests, except by forcing them to HTTP/1.0 (which you really, really don't want to do, do you? If you do, the environment variable to set is "downgrade-1.0")