Occasional misplaced gzip headers?

Maxim Dounin mdounin at mdounin.ru
Tue Apr 6 04:12:20 MSD 2010


On Mon, Apr 05, 2010 at 03:54:40PM -0700, Frank Farmer wrote:

> Thanks for the reply. Responses from our ops guy below:
>    Yep, looks like empty gzip file indeed. Such spurious bytes
>    before response may theoretically happen if subrequests are used
>    incorrectly (i.e.: do you use any 3rd party/your own modules?).
> No.


> keepalive_timeout 65;


>    If you are able to reproduce the problem it whould be helpfull to
>    look into problematic request/response debug log as well. See
>    here for details:
> We'll enable this log for one of the smaller sites we've been seeing
> this on, and see if anything interesting comes up.

Another possible reason include keepalive connection and backend 
sending gzip with wrong Content-Length (i.e. 0 which corresponds 
to original message length before gzipping instead of 26 after).

As nginx use HTTP/1.0 for backend connections and doesn't normally 
check length of upstream response it won't notice.  But client 
connection will be screwed up and next response will be incorrect 
from client's point of view.

You may try to disable keepalive to check if it helps.

Anyway it whould be great to see connection debug log with problem 
to say for sure.

Maxim Dounin

More information about the nginx mailing list