Hacker News new | ask | show | jobs
by mstdokumaci 5104 days ago
actually, http headers are not that easy to send. how do you plan to create "content-length" header before rendering whole response?
2 comments

This is why nginx gzips the body before writing the headers out.

You can use 'chunked_transfer_encoding' to enable chunking, combined with 'proxy_buffering off', your backend can stream the body and nginx will gzip the chunks. Disabling buffering has other consequences, so be sure to read up and experiment before you go to production.

Transfer-Encoding: chunked