4

There's a server that sends responses to HTTP requests, and these responses have a Content-Length header, but the server is proxied through nginx, which is configured to gzip the responses so they're smaller, but also causes it to use chunked transfer encoding, which doesn't specify a Content-Length. This means that the client doesn't know the response size when it starts receiving it, so, for example, a web browser can't display a progress bar. Is there any way to configure nginx to still gzip the response but compute and send an accurate Content-Length header instead of using chunked encoding?

(This is basically the same as this other question except it's nginx instead of Apache.)

Community
  • 1
  • 1
Avril
  • 813
  • 1
  • 9
  • 20

1 Answers1

1

Set chunked_transfer_encoding off;.

Xavier Lucas
  • 2,552
  • 20
  • 19
  • For me this did successfully disable chunked encoding, however it did not send a `Content-Length` header, it just added `Connection: close` instead, which has the effect of disabling keepalive connections. Nginx 1.10.3. For static content, the gzip_static module might support this. – thenickdude Jan 16 '18 at 09:41