This issue happens on a pure PHP files served by Nginx & PHP-FPM. I've stumbled upon this issue while developing my website using Symfony but the problematic content length range is 3702-15965 for that (I wonder why it's different than vanilla PHP).
What I've tried so far:
Notes:
Any help is appreciated. Thanks.
Funnily enough, I've solved the issue while writing the question. Adding fastcgi_buffering off;
to Nginx config fixes the issue.
But I still don't understand what was the problem and why disabling buffering fixed it. So if anyone can explain it I don't mind marking that answer as solution.