How would it be possible in nginx to evaluate if the Content-Encoding: gzip request header is set (coming from a web client to nginx), and then let nginx gunzip the request before it gets forwarded to an upstream (e.g. fastcgi)?

  • have you tried if ( $content_encoding = 'gzip') { gunzip on; } Feb 2, 2016 at 8:51
  • @DavidParlevliet I think the if condition is redundant. Feb 2, 2016 at 9:36
  • Thanks! But it seems that gunzip is only decompressing responses, not the incoming requests from a web client (I refined my question a bit). How could I nginx unzip a web request before it gets forwarded to an, e.g. fastcgi, upstream?
    – derFunk
    Feb 2, 2016 at 12:54

1 Answer 1


After more research it seems decompressing requests is not possible out of the box. Using LUA like described here is unfortunately not something I want to do: http://www.pataliebre.net/howto-make-nginx-decompress-a-gzipped-request.html#.VrCv87IrKHt.

Seems like I'd have to handle the decompression in my backend server code :/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .