[BUG] Gunzip module may cause requests to fail

Maxim Dounin mdounin at mdounin.ru
Mon Nov 30 17:37:17 UTC 2015


On Mon, Nov 30, 2015 at 04:29:09PM +0000, Aviram Cohen wrote:

> You are right, response bodies that are empty but still "encoded 
> as gzip" are a bit malformed.
> Unfortunately, sometimes we don't control the behavior of the 
> server. And still, I think Nginx should be able to handle such 
> responses and not disconnect the client.

As you said, such responses are "a bit malformed".  And nginx 
does its best at handling such malformed responses: it logs an 
error and closes the connection to prevent further damage.

The only potentially better option I can think of would be to 
don't touch such responses at all.  Unfortunately, this isn't 
really possible as response headers are already modified and sent 
to the client at the point when we know the response body is 

Another obvious solution would be to instruct nginx to don't try 
to gunzip responses if you don't control responses of your 
backend and there are malformed ones.  Actually, this is the 

Maxim Dounin

More information about the nginx-devel mailing list