LOADING...

206 Partial Content Error

1 Star2 Stars3 Stars4 Stars5 Stars (23 votes, average: 5.00 out of 5)

If you are working on any web project serving data (say video or fairly large image files), looking at the server logs might reveal a 206 partial content error. This, as many developers who’ve worked on media-rich projects, wouldknow, indicates that the requested data ranges have been loaded successfully, albeit in partial chunks, as would be expected for better performance on the browser.

In fact, a 206 partial content error is more of a good indicator that your HTTP assets are being loaded as desired. For instance, 206 partial content html5 videos are normally loaded in small chunks to avoid buffering as opposed to loading the entire video at the beginning thus forcing the user to wait for several minutes before watching. Partial loading has to specified in the header for any incoming requests.

It’s also an indicator that the server in use supports part or range requests for smoother user experiences. Partial ranges have been supported by most servers and enabled by most developers for quite some time now.

206 Partial Content Examples

There are several instances where HTTP 206 partial content errors/ alerts could be generated on load from any server. Here are a few practical examples with detailed explanations of what each example means:

Single range 206 partial content error

GET /my_video/cat_video.mp4 HTTP/1.1″ 206 1330466

Here is the above error in full as you would see it from your server logs:

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-Range: bytes 26050-57026/77022
Content-Length: 27405
Content-Type: video/mp4

… 27405 bytes of partial image data …

The above 206 partial error indicates that the video Get request is being served in part or chunks to the user’s 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. It’s a preferred way to optimize media loading on most platforms to cater for bandwidth and latency variations from one use to the other.

Of course, partial loading may not be ideal for every scenario. It can be turned off on the server config file specific to your web server.

206 Partial Content Error

Multiple Range 206 Partial Content Error

A slight variation to the 206 partial content error is where multiple partial requests are issued with the HTTP get request. In this case, the server will log the request with all the ranges specified in the Get header and fulfill that request on the client side. Range requests can return multiple byte ranges and may not be supported by some web servers unless explicitly enabled by the developer.

Here is what a get request snapshot/log for a multiple range header would look like on your server:

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-Length: 1453
Content-Type: multipart/byteranges; boundary=String_separator

–String_separator
Content-Type: application/mkv
Content-Range: bytes 234-639/8000

…the first range…
–String_separator
Content-Type: application/mkv
Content-Range: bytes 4590-7999/8000

Range requests are common where a server is set to allow multiple file access or download. For instance, a multiple download application sending multiple Get requests would make use of such.

206 Partial Content Explored in Detail

What exactly is a 206 partial content message in HTTP requests? In brief,any 206 partial content is an indicator that part of a requested resource or file stored in a web server has been successfully loaded and available to the end-user. In more practical but somewhat laymen, terms, think of the following web session and how it can be interpreted in the 206 partial content code case.”

A client visits a video download page and starts playing or downloading a specific video on your web server. Typically, their download software or video player would send a simple HTTTP Get request. In the header, a specific partial chunk of the said file will be requested.

If the said server supported partial loading of resources, a success HTTP 206 code/error would be generated to signify that that specific chunk of the video file has been loaded successfully.The server would then wait for the user to send another Get request to send the remaining chunks or skip and move to other parts of the video in case they chose to seek or fast forward the video file.

When there is only one resource or file that is requested, the 206 code,as displayed in the server logs, only shows the type of document requested (e.g.,Mkv, pdf, mp4, among others). Multiple ranges, on the other hand, will show specific byte ranges in the content type with both content range and content type in the code, as shown in the examples above.

That said, there is one obvious exemption to the described HTTP requests. Non-matching E Tag headers for cached content cannot include a 206-code response. Some caches do not support these types of headers as well.

As a recap, here is what HTTP 206 responses indicate:

  • The server in question has completed a partial HTTP Get request and sent the requested part of the file to the user or has fulfilled a range request in the case of multiple files.
  • Single part transfers are identified by a 206 response without a content-range header filed with a specific file type as part of the response (e.g., content-type: image/jpg).
  • Multiple partial requests are identified by a 206 response with specific byte ranges as part of the response alongside specific content-type fields for each of the files or assets being loaded through the HTTP Get request.
  • Servers can generate multiple-range partials when a user requests a single part but cannot do the same for the other way round (sending multiple-range partial responses for a single request).

Some 206 Code References

Below are some code references for 206 partial responses for a number of languages:

Python 3.5 or higher –http. HTTP Status.PARTIAL_CONTENT – this code reference is for HTTP Status constant indication

Rails-: partial_content- this code is for setting the http status symbol

PHP code references

To check if a server supports 206 requests (partials)

Issue the following HEAD request using Curl

Curl -I http://i.sitename.com/filename.extesnion

If the server supports the partial requests, you will receive the following server response:

HTTP/ 1.1 200 OK

Accept-Ranges: bytes

Content-Length: 134455

Be sure to replace the “sitename” and “filename”placeholders with real values.

A server that does not accept partial range requests or has the feature disabled by default will return the following response:

HTTP/ 1.1 200 OK

Accept-Ranges: none

What Does the HTTP 206 Partial Content Status Message Mean and How Do I Fully Load Resources?

The HTTP 206 partial content status message indicates that your server allows/supports partial Get requests. It’s used to allow large files to be downloaded or requested progressively and quite useful for low bandwidth or users with limited connectivity.

You can load your resource fully by either sending multiple requests until the entire resource is loaded (especially as an end-user though this is mostly an automated process) or disabling partial loading from the server-side. Here is an example of how you can disable or enable partial requests as a developer from the server-side on apache:

Access the httpd.conf file on your server and modify or remove this line appropriately:

Header set Accept-Ranges bytes

Sometimes, 206 partial content errors might be generated erroneously due to cross-domain issues or wrong server configuration. In such cases, adding a fresh hta. access file to your root server folder would help. Include the following code in the file:

<IfModule mod_headers.c>

Header set Access-Control-Allow-Origin "*."

</IfModule>

What Does HTTP Code 206 (Partial Content) Really Mean?

HTTP code responses are automatically generated on the server whenever partial content requests are made. For instance, almost all video streaming platforms rely on partial requests to load videos progressively. This allows the server to serve resources that are needed,thus saving on bandwidth both on the server end and client end.

Imagine if you had to wait for an entire 1GB YouTube file to load before you could watch it?

Such requests could most definitely mean a lot of buffering and wasted resources, as most users don’t even watch a video to the very end. It also allows developers to allow other resources (such as fonts and text) to load alongside media for smooth experiences.

Most servers allow HTTP 206 partial loading by default unless specifically turned off on the config file. However, partial range requests might be disabled, especially where a developer wants to restrict bulk downloading of resources on a web server. This can be easily accomplished by altering the config file for the webserver in use.

QueryingHTTP Status: 206 Partial Content andRange

GET /45925416992.jpg HTTP/1.1
Host: https://farm4.static.flickr.com/
Range: bytes=0-999
HTTP/1.0 206 Partial Content
Date: Mon, 05 Dec 2019 07:24:24 GMT
Server: Apache/2.0.52 (Red Hat)
Accept-Ranges: bytes
Content-Length: 1000
Content-Range: bytes 0-999/3980
Content-Type: image/jpeg

Testing HTTP Status: 206 Partial Content and Range Requests

Testing and setting range requests on a web server can be done with a few lines of code or through the httpd.conf file for most servers.

Send a random curl or get request specifying a specific file and specify the range in the header as follows:

GET/Curl filepath/filename.extension HTTP/1.1

Host: hostname.Extensione.g. (https://farm4.static.flickr.com/)

Range: bytes= “number of bytes).

Be sure to replace the placeholders with real filenames and extensions.

All in all, 206 partial responses are an essential and often, non-intrusive, component of the web. Unless for very special cases, you or the user will never at any point have to mess with 206 HTTP errors as you create your applications, websites, or surf the web.

499 Error Code

401 Unauthorized Error

Free Website Hosting