206 Partial Content
Delivering part of the resource due to range headers sent by the client.
Usually happens because:
- ☑ Clients requesting specific byte ranges
- ☑ Multi-part range requests asking for
🔍 Quick Checklist:
Meaning
The HTTP 206 Partial Content success status code indicates that the request has succeeded and the body contains the requested ranges of data, as described in the Range header of the request.
Root Causes
- Clients requesting specific byte ranges of large files to resume downloads.
- Multi-part range requests asking for multiple non-contiguous segments of a file.
| Cause | Frequency |
|---|---|
| Clients requesting specific byte ranges | ⭐⭐⭐⭐⭐ |
| Multi-part range requests asking for | ⭐⭐⭐⭐ |
Common Mistakes
- Returning a full 200 OK response with the entire file, ignoring the client's Range header.
- Miscalculating byte offsets, leading to corrupted data transfers.
How to Fix
Framework-Specific Examples
Streaming partial file content using Node.js stream structures in Express.
app.get('/video', (req, res) => {
res.status(206).end();
});Server Configuration Examples
Configuring Nginx byte range slices.
slice 1m;
proxy_set_header Range $slice_range;Prevention
- Use server defaults instead of writing raw byte range calculations.
- Always set correct Content-Range and Content-Type response headers.
Frequently Asked Questions (FAQ)
Q: Why is HTTP 206 critical for video streaming?
It allows video players to request small chunks of a video file dynamically as the user watches, instead of downloading a multi-gigabyte file all at once, saving bandwidth and improving buffer speed.
Q: What header specifies the file ranges allowed?
The server returns the 'Accept-Ranges: bytes' header to indicate that it supports partial downloads.
Q: What is the difference between 206 and 416?
206 indicates success in delivering the requested range, while 416 (Range Not Satisfiable) means the client requested bytes outside the file size limits.
Q: Can I request multiple byte ranges in one request?
Yes. The server will return a 'multipart/byteranges' payload containing each block separated by boundary flags.