Does Nginx supports If-Range ?

Maxim Dounin mdounin at mdounin.ru
Tue Jul 4 12:21:14 UTC 2017


Hello!

On Mon, Jul 03, 2017 at 05:09:28PM -0300, Nelson Marcos wrote:

> I don't know if it is an expected behaviour or a bug:
> 
> 
> Scenario 1(OK): If I perform a request *with the header Range*,  Nginx
> serves the *partial content(HTTP 206)*.
> 
> Scenario 2 (NOT OK): If I perform a request *with the header Range AND the
> header "If-Range" *with the Etag, Nginx serves the *entire file*(200). Why
> not serve the partial content if its cached version matches the If-Range
> header?
> 
> In both scenarios the file is already cached.
> 
> Here is my conf: https://pastebin.com/gQQ0GSg6
> 
> Here are my requests and my files: https://pastebin.com/rxLwYaSK

The "ETag" header in the response is invalid, as well as 
"If-Range" in the request.  Quoting from the second link:

: Etag: 345a2dd5c8f22e9ffaf250151ea820df
: If-Range: 345a2dd5c8f22e9ffaf250151ea820df

In both cases entity tag should be in double quotes, see 
https://tools.ietf.org/html/rfc2616#section-14.19.

Fixing your backend to return correct ETag will make things work.  
Alternatively, you can use Last-Modified date in the If-Range 
request header instead.

-- 
Maxim Dounin
http://nginx.org/


More information about the nginx mailing list