Docker Big file download stops at 99% and fails


running docker image 17.0.1 I noticed the following issue.
I shared a big file (789M) by link.
The download work fines until it reaches 785 or 786 M and then stops.
It stays like this for a while and then appear as failed
Same behavior with Chrome or FF

it is like if the last “second” of download never occurs
speed is arround 4M/s and it stop near the last 4M

I checked and did not see any relevant info in nextcloud logs.

I tried changing a set of nginx config directives but that did not solve the issue.
Any help appreciated

reproduced the error using wget:

Registered socket 3 for persistent reuse.
Length: 826922675 (789M) [application/zip]
Saving to: ‘download.2’

download.2 99%[=======================================================================> ] 785.04M 2.16MB/s in 4m 39s

Disabling further reuse of socket 3.
2019-11-24 15:40:17 (2.81 MB/s) - Read error at byte 823178012/826922675 (Success.). Retrying.

I have been testing more
issue occurs only with zip files, any size


I have found the solution to my issue.
Not sure if my config change shall be taken into the delivered confs:

I noticed in the stderr of web (nginx):
an upstream response is buffered to a temporary file xxx while reading upstream

I have added the following directives to my nginx.conf

fastcgi_max_temp_file_size 0;
fastcgi_buffer_size 4K;

and now it is working fine