missing Content-Length in nginx response

Maxim Dounin mdounin at mdounin.ru
Thu Apr 14 14:29:08 MSD 2011


Hello!

On Thu, Apr 14, 2011 at 01:50:49AM -0600, Ruslan Dautkhanov wrote:

> Hello,
> 
> I have problems in a transition from Apache to nginx.
> 
> There are 2 nginx servers working together:
>  nginx (balancing, proxy) -> another nginx -> static files and php-fpm
> 
> Pages that are loaded through ajax doesn't show up.
> 
> I checked through Firebug and the only differences are in following
> response headers
> 1. Transfer-Encoding chunked    (presents only in Nginx response)
> 2. Content-Length 571    (presents only in Apache response)...
> 
> How I can force nginx to work correctly here? Please see full dump of
> headers below.

There is nothing incorrect in returning chunked response as long 
as client uses HTTP/1.1.

I tend to think that your issue is unrelated.  You may want to dig 
further into your ajax code to see what actually goes wrong.

> nginx 0.8.54
> Tried to switch off gzip - it didn't affect this issue at all.
> ssl is not used in this configuration.
> CentOS 5.5.

nginx uses chunked if (a) response length isn't known (i.e. 
backend doesn't return it) or (b) it has to modify response body.

The (b) includes gzip filter, ssi filter, sub filter, addition 
filter, and charset filter.  With all of them switched off 
(default) you should see original Content-Length from backend's 
response (if any).

Maxim Dounin



More information about the nginx mailing list