22

I know that you can use nginx HttpGzipModule to gzip responses. Can you als use it to enable nginx to handle gzip-compressed requests, i.e. ones with the request header: Content-Encoding: gzip ?

Note: Apache, with the help of mod_deflate can handle gzip-compressed requests with the directive SetInputFilter DEFLATE.

Related

http://forum.nginx.org/read.php?11,96472,214266

3 Answers 3

7

I just tried this on an nginx server I have sitting in front of an Apache backend.

curl -H "Content-Encoding: gzip" --include -d @testfile.gz http://example.com/upload_file.php

curl automatically added:

Expect: 100-continue

to the request headers.

nginx sent back a

HTTP/1.1 100 Continue

response and curl followed up by sending the gzipped data. nginx passed the whole lot back to Apache, still compressed and still with the Content-Encoding: header intact.

If I didn't add the Content-Encoding: gzip header with curl, I didn't get the HTTP 100 response but everything else was the same.

This doesn't answer your question yet but it does imply that nginx either doesn't handle this by default or doesn't uncompress the body of the request when it is proxying. I'm interested in the answer to this one so I'll see if I can try it out on a non-proxying nginx server a bit later on.

Presumably you could solve the bandwidth problem by proxying those requests to an Apache backend with mod_deflate but that ignores the reason you chose nginx in the first place.

1
  • 1
    Thanks. Have you tried on a non-proxying nginx server?
    – ma11hew28
    Apr 21, 2012 at 22:27
4

Just found this article: Howto make Nginx decompress a gzipped request

It looks good, but I haven't tried it yet. Hope it helps.

1
  • 1
    Whilst this may theoretically answer the question, please provide context around links so others will have some idea what it is and why it’s there. If possible summarise or quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.
    – HBruijn
    Sep 15, 2015 at 15:06
-2

I found good steps on digital ocean for Ubuntu 14.04

Its good

3
  • 1
    Hi, link only answer tend to die with time, please post and quote the step, and make a link to it is a better way to answer there. Thanks !
    – yagmoth555
    Feb 13, 2019 at 13:14
  • Before I wrote wrong link. Now I have updated correct link. Feb 14, 2019 at 10:32
  • 2
    This is for response compression, not request compression. Mar 10, 2022 at 19:52

You must log in to answer this question.

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