Transfer-encoding: chunked, streaming data transfer for big files

Hi

I’m trying to stream big files with “transfer-encoding: chunked” with server functions (typescript).
Its done to only allow authenticated users to download the files and to hide the src url.
What worked was to read the whole file and return it at once, but that is only usable for small files.

Locally I get these response headers, with a simple text file (but the idea is to server big pdfs, zip files). That works.

content-disposition: attachment; filename=test.txt
content-type: text/plain
transfer-encoding: chunked
...

When its run on a netlifly deploy its changed to

content-disposition: attachment; filename=test.txt
content-encoding: br
content-type: text/plain
netlify-vary: query
...

It somehow works, the funny thing is that instead of the text content it returns a comma seperated list of the ascii number of the chars.

Under Custom headers | Netlify Docs its shown that Transfer-Encoding is not supported.

So how to best implement this use case on netlifly?

Is there a reproduction we can test?