On Wed, Mar 02, 2016 at 09:58:26PM +0530, Vikas Parashar wrote:
I am using nginx(caching server) in front my tomcat. My tomcat is serving
header(content-length). But my nginx is not serving header content-length.
However, i can put that header in my config with some static value then it
will serve. But, in my case, the content length is coming from tomcat
The “Content-Length” header is expected to be automatically
removed by nginx if it does some processing on the response body
and the length can be changed during processing. In particular,
this includes the following cases:
the response is gzipped (“gzip on”);
SSI is enabled;
sub_filter is enabled.
Various 3rd party modules can also remove Content-Length.
If you want to preserve Content-Length, you should identify which
modules remove Content-Length in your particular configuration and
switch them off.
Note: this directive in your config prevents nginx from using
“Transfer-Encoding: chunked” to indicate response length. As a
result nginx won’t be able to maintain persistent connections with
clients when Content-Length isn’t known in advance.
Unless you’ve added this directive to resolve specific problems
with broken clients and you know for sure you need it, you may
want to remove this directive from your configuration.