Nginx removing content-length header

Nginx is removing the content-length header.

The goal is to return a video. To make it simple I wrote a simple php script who returns the video setting among other herders the content-length header with the file size.

When the page is served by nginx the content-length header is removed while if I use the php server the header is not removed.

On my local ddev config running nginx the header is not removed. I have this issue on a bookworm debian running nginx 1.26.3

Comparing the two nginx settings local and dist they look the same… meanwhile… the header keeps disappearing.

If anyone had a clue about this it’d be great.
Thanks

1 Like

It sounds like Nginx might be handling the response differently due to buffering or gzip compression. Try adding gzip off; and proxy_buffering off; in your config or serving the file with X-Accel-Redirect. Also, check if any modules (like fastcgi or proxy_pass) are stripping the Content-Length header.