nginx Gzip file download not working

Francis Daly francis at daoine.org
Mon May 14 22:21:27 UTC 2012


On Sun, May 13, 2012 at 04:19:26AM -0400, pralive wrote:

Hi there,

> When i try to download a file using "curl -H "Accept-Encoding: gzip"
> http://abc.com/xx.epub" ,almost 99% file downloads and then it hangs and
> end up with this message "curl: (18) transfer closed with 2693 bytes
> remaining to read".

Can you set up a test system, and find a minimum configuration that
shows the problem you are seeing?

> Please help.Do i need to change anything in server
> side to make this  work?

The reason I ask, is: with this gzip-related configuration, and the rest
being defaults, I don't think that the gzip handler is involved here.

When I try the following test:

nginx.conf:
===
events {
    worker_connections  1024;
    debug_connection 127.0.0.1;
}

http {
    include mime.types;

    gzip on;
    gzip_min_length 1100;

    server {
        listen       8000;
    }
}
===

# create my test file
perl -e 'print "1234567890" x 111' > html/xx.epub

Then I can run the curl commands to get the file:

curl -I http://localhost:8000/xx.epub
curl -I -H 'Accept-Encoding: gzip' http://localhost:8000/xx.epub

and they show the same response.

If I add the line

    gzip_types text/plain;

to nginx.conf and reload, then the plain curl shows me

Content-Type: text/plain
Content-Length: 1110

while the gzip one shows

Content-Type: text/plain
Content-Encoding: gzip

So: I'm unable to replicate the problem you report; and it doesn't
immediately seem related to gzip.

Can you provide a replication recipe that someone else could run to see
the same problem?

Do you see the problem with any other file? Or with the same file on a
different server?

Also, the output of "nginx -V" and the logs, are likely to be useful.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list