Answer the question
In order to leave comments, you need to log in
Nginx, Partial content and gzip?
Greetings!
Faced with the fact that Nginx does not compress the response if you specify the range of data transfer, i.e.
if you use
curl --header "Range: bytes=0-5000000" 192.168.2.191/patcher/windows/1.0.0/program.exe >part1
curl --header "Range: bytes=5000001-9152512" 192.168.2.191/patcher /windows/1.0.0/program.exe >part2
then we get 2 pieces of the required file in uncompressed form, pieces of different lengths, but uncompressed.
If we add
--header "Accept-Encoding: gzip,deflate" to each request,
then we get 2 identical pieces, which are a fully compressed file.
In the logs, the server honestly says that partial content is not used:
in the first case:
192.168.2.191 - - [01/Apr/2013:12:07:40 +0300] "GET /patcher/windows/1.0.0/program.exe HTTP/1.1" 206 5000001 "-" "curl/7.21.0 ( x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6"
192.168.2.191 - - [01/Apr/2013:12:07:52 + 0300] "GET /patcher/windows/1.0.0/program.exe HTTP/1.1" 206 4152511 "-" "curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6"
And in the second:
192.168.2.191 - - [01/Apr/2013:12:14:37 +0300] "GET /patcher/windows/1.0.0/program .exe HTTP/1.1" 200 4167250 "-" "curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6"
192.168.2.191 - - [01/Apr/2013:12:14:52 +0300] "GET /patcher/windows/1.0.0/program.exe HTTP/1.1" 200 4167250 "-" "curl/7.21.0 ( x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6"
You can't compress data at all if ranges are specified, or I missed something in the dock ?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Doesn't work at the same time. There was a module for similar purposes, but there the range is passed through parameters, and not in headers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question