-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Symfony version(s) affected
4.4.44+, v5, v6
Description
In Symfony up to 4.4.43 the Apache automatically add the Content-Lenght
header.
HTTP/1.1 200 OK
Date: Thu, 27 Jul 2023 08:22:47 GMT
Server: Apache/2.4.52 (Ubuntu)
Cache-Control: no-cache, private
X-Debug-Token: 3ab75d
X-Debug-Token-Link: http://xxx.local/_profiler/3ab75d
X-Robots-Tag: noindex
Content-Length: 736
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Content-Type: application/json
After the 4.4.44 (and also in 5+ and 6+) the Apache does not set this header and also switches itself to Transfer-Encoding: chunked
. The headers sent after v4.4.44 are:
HTTP/1.1 200 OK
Date: Thu, 27 Jul 2023 08:21:57 GMT
Server: Apache/2.4.52 (Ubuntu)
Cache-Control: no-cache, private
X-Debug-Token: 6505c3
X-Debug-Token-Link: http://xxx.local/_profiler/6505c3
X-Robots-Tag: noindex
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json
How to reproduce
I have tracked this issue to appear after introducing the flush()
call in #46931 and later moved to another place in #47434. Removing the flush()
call reverts to the original behavior in v4.4.44+ and v5.
I wouldn't have noticed this change if my API wouldn't be used by some hand-crafted HTTP clients that are used inside firmwares of low-level devices. They can't parse the chunked
responses so I really need to maintain the response encoding for some of my endpoints.
I understand that such change is not a breaking change for most of the users, but in my case it prevents me from upgrading to v4.4.44 and later to v5.
Possible Solution
I would like to ask if you know of some solution that would force the Apache to behave as previously. It might be an Apache configuration or some PHP code extension. Maybe the flush()
call should be optional and turned on in the configuration?
I lack a knowledge of this internals and therefore could not come up with a solution myself.
Additional Context
No response