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; } – David Parlevliet Feb 2 '16 at 8:51
  • @DavidParlevliet I think the if condition is redundant. – Richard Smith Feb 2 '16 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 '16 at 12:54

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 :/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.