What does HTTP Status Code 206 partial content mean?
A 206 partial content error might occur if you’re working on a web project that serves data (e.g. video or large images). As developers who have worked on media-rich websites will know, this indicates that the requested data has been loaded successfully. However, it is in smaller chunks than would be expected to improve the browser’s performance.
A 206 partial content error is actually a better indicator that your HTTP assets have been loaded correctly. To illustrate, 206 partial content HTML5 videos are usually loaded in smaller chunks to avoid buffering. This allows the user to watch the video for several minutes instead of waiting. Any incoming requests must include partial loading.
This is a sign that the server being used supports partial or range requests to provide smoother user experiences. For a long time, partial ranges have been supported and enabled by most servers.
Examples of Partial Content 206
HTTP 206 partial error/ alerts can be generated from any server in many cases. These are some examples that you can use to help explain what each one means.
Single range 206 partial content error
GET /my_video/cat_video.mp4 HTTP/1.1'' 206 1330466
The above error is as clear as possible, just like you’d see it in your server logs.
HTTP/1.1 206 Partial ContentDate: Mon, 05 Dec 2019 07:24:24 GMTLast-Modified: Mon, 05 Dec 2019 06:20:24 GMTContent-Range: bytes 26050-57026/77022
… 27405 bytes partial image data
The 206 partial error above indicates that the video Get request was being served in parts or chunks to the browser window. This is normal as most HTTP video players progressively load a video based on the user’s navigation(forwarding, seeking, or linear loading) until the entire video is loaded. This is a great way to optimize media loading on all platforms and to accommodate bandwidth and latency variations between one use.
Partial loading is not ideal for all situations. You can disable partial loading in the server configuration file for your web server.
Multiple Range 206 Partial Content Error
The HTTP get request may also contain multiple partial requests. This is a slight variation on the 206 partial content errors. The server will log this request and fulfill the request on the client’s side with all ranges specified in Get header. Range requests may return multiple bytes and may not work with all web servers, unless the developer explicitly allows it.
Here’s how a get request snapshot/log would look on your server for a multiple-range header:
HTTP/1.1 206 Partial content
Date: Mon, 05 Dec 2019 07:24:24 GMT
Last-Modified: Mon, 05 Dec 2019 06:20:24 GMT
Content-Type: multipart/byteranges; boundary=String_separator
Content-Range: Bytes 234-639/8000
…the first range…
Content-Range: bytes 4590-7999/8000
When a server allows multiple file access or downloads, range requests are common. A multiple download application could send multiple Get requests.
206 Partial Content In Detail
What is a 206 part content message in HTTP requests exactly? Any 206 partial content message in HTTP requests is a sign that a portion of a requested resource has been loaded successfully and made available to the user. The following web session can be described in more concrete terms.
The client visits a video download page to play or download a particular video from your server. A simple HTTP request would be sent to the client’s video player or download software. A specific portion of the file will be requested in the header.
If the server supports partial loading of resources, a successful HTTP code/error will be generated to indicate that the requested chunk of video has been successfully loaded. The server then asks the user to send another Get request to continue the process.
If there is one file or resource that is being requested, the 206 code will only show the requested type of document (e.g. Mkv, pdf and mp4, among other things). Multiple ranges will, however, show-specific byte ranges within the content type with both the content range and the code as shown in these examples.
That said, there is one obvious exemption to the described HTTP requests. A 206-code response cannot be included in non-matching E Tag headers. These types of headers are not supported by all caches.
Here are the HTTP 206 code responses.
- The server has sent the requested file via partial HTTP Get to the user. If multiple files are involved, the range request has been fulfilled.
- A 206 response is sufficient to identify single part transfers. It does not need a content-range header and must include a specific file type in the response (e.g. content-type: image/jpg).
- Multiple partial requests can be identified with a 206 response that includes specific byte ranges and specific content-type fields. This response is also used to identify the assets or files being loaded via the HTTP Get request.
- While servers can generate partials with multiple ranges of parts when a user requests one part, they cannot do it the opposite way (sending multiple-range partial replies for a single request).
Some 206 Code References
Here are some code references to 206 partial answers for a variety of languages:
Python 3.5 and higher -http. HTTP Status.PARTIAL_CONTENT – this code reference is for HTTP Status constant indication
Rails– partial_content – This code is used to set the HTTP status symbol
PHP code references
Check if the server can handle 206 requests (partials).
Use Curl to issue the HEAD request below
If your server supports partial requests, the following response will be returned to you:
HTTP/ 1.1 200 OK
Be sure to replace the “sitename” and “filename” placeholders with real values.
Servers that refuse to accept partial range requests, or have the default feature disabled by default, will give the following response.
HTTP/ 1.1 200 OK
What does the HTTP 206 Partial Content Status message mean? How can I fully load resources?
HTTP 206 partial status messages indicate that your server supports partial Get requests. This message is used to permit large files to be downloaded/requested progressively. It is very useful for users with low bandwidth or limited connectivity.
The two options to load your resource fully are sending multiple requests (especially for end-users though this is mostly automated) and disabling partial loading from the server-side. This is how you disable or enable partial requests from apache’s server-side.
You can modify or delete this line by accessing the httpd.conf file from your server.
Header set Acceptable Ranges bytes
Sometimes, partial content errors of 206 might be caused by cross-domain issues or incorrect server configurations. In these cases, you might need to add a new hta. Access file to root server folder is a good idea. In the file, include the following code:
Header set Access-Control-Allow-Origin “*. “
What does HTTP Code 206 Partial content really mean?
When partial content requests are made, HTTP code responses are generated automatically on the server. Partial requests are used to load video progressively on almost all video streaming platforms. This allows the server only to serve the resources it needs, thereby reducing bandwidth on both the client and server ends.
Imagine waiting for a YouTube file of 1GB to load before you can watch it.
These requests can lead to a lot more buffering and waste of resources. Most users won’t watch videos past the end. Developers can also allow developers to allow additional resources, such as fonts or text, to load alongside media to provide smooth experiences.
Servers allow partial HTTP 206 loading by default unless explicitly turned off in the config file. Partial range requests can be disabled if a developer wishes to limit bulk downloads of resources on a server. You can do this by changing the configuration file of the webserver.
QueryingHTTP Status – 206 Partial Content and Range
GET /45925416992.jpg HTTP/1.1
HTTP/1.0 206 Partial content
Date: Mon, 05 Dec 2019 07:24:24 GMT
Server: Apache/2.0.52(Red Hat).
Content-Range : bytes 0-999/3980
Test HTTP Status: 206 Partial Content & Range Requests
You can test and set range requests on web servers with just a few lines of code.
Send a random curl request or get a request specifying a file. The header should include the range as follows:
GET/Curl filepath/filename.extension HTTP/1.1
Host: hostname.Extension.g. (https://farm4.static.flickr.com/)
Range: bytes = “numbers of bytes”
Replace placeholders with actual filenames and extensions
206 partial answers are an important and, often, a non-intrusive component of the internet. Except in very rare cases, neither you nor the user will ever have to deal with 206 HTTP errors while you create or update your websites or applications.
When should I use HTTP 206?
When a client requests a range, the server may send this Partial Content status code 206. (e.g. “give me the first 2MB of video data”). It’s essential for downloading data in pieces and avoiding obtaining resources that aren’t needed.
I hope this article was able to help you with your doubts and queries related to the HTTP status code 206 partial content. Still, if there are any questions you have that are unanswered, feel free to ask them in the comment section, we would be happy to assist you. Thank you.