Range request with Accept-Encoding:“gzip,deflate" for *.pdf.* file-name pattern returns 416

yogeshorai nginx-forum at forum.nginx.org
Mon May 9 12:39:31 UTC 2016

We are facing this weird behavior wherein if a range request with
Accept-Encoding:“gzip,deflate" is called for a url having .pdf as part of
path, nginx would throw 416 even if the range is well within overall size of
source file

Also this happens for Range request  "Range: bytes=20-" and above while same
would work if its less that 20 bytes as start of range eg  "Range:

Nginx Version : 1.8.0

Sample curl 

curl  -v --user "xxx"  -H "Host:yyy.com" --compressed  -H "Range: bytes=20-"

Response :
> GET /api/v1/fs-content/Shared/0test/latest.pdf.test.txt HTTP/1.1
> User-Agent: curl/7.35.0
> Accept: */*
> Accept-Encoding: deflate, gzip
> Range: bytes=20-
< HTTP/1.1 416 Requested Range Not Satisfiable
< Date: Mon, 09 May 2016 12:34:03 GMT
< Content-Type: text/html; charset=iso-8859-1
< Transfer-Encoding: chunked
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000
<title>200 OK</title>
<p>None of the range-specifier values in the Range
request-header field overlap the current extent
of the selected resource.</p>

Sample access log -  [08/May/2016:23:03:20 -0700] "GET
HTTP/1.1" 416 466  "qaaa.egnyte.com" "-" "curl/7.19.7
(x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/ zlib/1.2.3 libidn/1.18
libssh2/1.4.2" "deflate, gzip" "D0536872:4496_0A19800C:01BB_--_3B70C9"
"-:bytes=20-" "" "-" "text/html; charset=iso-8859-1" "" "" "" "" "" ""
"0.023" "0.023" "BYPASS"

Note :
Earlier we had an issue with If-Range header value format to match with Etag
value and had to add a patch mentioned here

Kindly suggest.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,266713,266713#msg-266713

More information about the nginx mailing list