HTTP headers are used to pass additional information with HTTP request or response. HTTP range is an HTTP request header that is used to get part of a document from the server. If the server returns the part of the document, it uses the 206 (Partial Content) status code. If ranges are invalid status code used is 416 (Range Not Satisfiable) and the server uses status code 200 (OK) in case it ignores the range request.
- To get whole document starting from a particular range
- To request multiple parts
Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>
- To request specific end part of the document
Directives: There are four directives accepted by HTTP Range header, mentioned above and described below:
- unit: It specifies the unit in which range is given. Generally bytes are used.
- range-start: It is the integer specifying the starting of the document part.
- range-end: It is the integer specifying the ending of the document part. It is an optional directive.
- suffix-length: It is an integer indicating the end part of the document to be returned.
- To get first 100 bytes of the file
- To get last 100 bytes of the file
- To request multiple ranges
Range: bytes=0-99, 700-799
To check this Range in action go to Inspect Element -> Network check the request header for Range.
Supported Browsers: The browsers supported by HTTP header Range are listed below:
- Google Chrome
- Internet Explorer
- HTTP headers | Content-Range
- HTTP headers | Access-Control-Expose-Headers
- HTTP headers | Access-Control-Allow-Headers.
- HTTP headers | Allow
- HTTP Headers | TE
- HTTP headers | Via
- HTTP headers
- HTTP headers | Age
- HTTP headers | Server
- HTTP headers | Expect-CT
- HTTP headers | expires
- HTTP headers | Retry-After
- HTTP headers | SourceMap
- HTTP headers | Origin
- HTTP headers | Set-Cookie2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.