Re: Range request with Accept-Encoding:“gzip,deflate" for *.pdf.* file-name pattern returns 416
Maxim Dounin
mdounin at mdounin.ru
Tue May 10 14:41:05 UTC 2016
Hello!
On Mon, May 09, 2016 at 08:39:31AM -0400, yogeshorai wrote:
> 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:
> bytes=19-"
>
> Nginx Version : 1.8.0
>
> Sample curl
>
> curl -v --user "xxx" -H "Host:yyy.com" --compressed -H "Range: bytes=20-"
> https://yyy.com/api/v1/fs-content/Shared/0test/latest.pdf.test.txt
>
> 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
> <
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>200 OK</title>
> </head><body>
> <h1>OK</h1>
> <p>None of the range-specifier values in the Range
> request-header field overlap the current extent
> of the selected resource.</p>
> </body></html>
>
>
> Sample access log
>
> 172.26.7.15 - [08/May/2016:23:03:20 -0700] "GET
> /public-api/v1/fs-content-download/Shared/0test/latest.pdf.test.txt
> HTTP/1.1" 416 466 "qaaa.egnyte.com" "-" "curl/7.19.7
> (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 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"
The response is returned by your backend, not by nginx. Try
looking at your backend instead.
> 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
> http://permalink.gmane.org/gmane.comp.web.nginx.devel/2579
The patch in question is only needed if your backend is broken and
doesn't follow HTTP standard. You may consider fixing your
backend instead.
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list