I'm using Apache 2.2 and PHP 7.0.1. I force chunked encoding with
header('HTTP/1.1 200 OK');
HTTP/1.1 200 OK
Date: Fri, 09 Sep 2016 15:58:20 GMT
Server: Apache/2.2.15 (CentOS)
Content-Type: text/html; charset=UTF-8
As @Joe pointed out before, that is the normal behavior when Chunked transfer enconding is enabled. My tests where not accurate because I was requesting Apache directly on the server. Actually, when I was experiencing the problem in Chrome I was querying a Nginx service as a proxy for Apache.
tcpdump I realized that Nginx was rechunking responses, but only when rewritting HTTP status header (
header('HTTP/1.1 200 OK')) in PHP. The solution to sending
Transfer-Encoding: chunked twice is to set
chunked_transfer_encoding off in the
location context of my Nginx .php handler.