Occasional misplaced gzip headers?

Maxim Dounin mdounin at mdounin.ru
Tue Apr 6 02:27:48 MSD 2010


Hello!

On Fri, Apr 02, 2010 at 05:18:56PM -0700, Frank Farmer wrote:

> Hi all,
> 
> I've been seeing rare malformed responses from nginx with a strange
> 26 byte header prepended to them.
> 
> $ od -c file.part | head
> 0000000 037 213  \b  \0  \0  \0  \0  \0  \0 003 002  \0  \0  \0 377 377
> 0000020 003  \0  \0  \0  \0  \0  \0  \0  \0  \0   H   T   T   P   /   1
> 0000040   .   1       2   0   0       O   K  \r  \n   S   e   r   v   e
> 
> The first two bytes look suspiciously like a gzip header.

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?).

Could you please show nginx -V output and your config?

> I saw a problem like this back in April '09 when I first deployed
> nginx as a reverse proxy in front of Apache:
> 
> http://stackoverflow.com/questions/736499/strange-http-gzip-issue

This is completely different problem and it's in Apache, not 
nginx.

[...]

> Recently, we moved nginx to a separate box on the same LAN, keeping
> the same version (0.6.35 -- I know, it's old, but it's been stable).
> Suddenly, we're seeing very similar symptoms again.  It doesn't
> happen reliably, and it doesn't happen often.  I had one user report
> 3 instances over the course of 15 minutes.  After receiving a
> garbled response, a second request for the same URL seems to
> succeed.

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:

http://nginx.org/en/docs/debugging_log.html

Maxim Dounin



More information about the nginx mailing list