HTTP 206 Partial Content — What It Means and How to Fix It
The HTTP 206 (Partial Content) status code indicates that the server has successfully fulfilled a partial GET request for the resource. This typically occurs when a client, such as a web browser or download manager, requests only a portion of a larger file using the Range header.
Essential Reading: Designing Data-Intensive Applications
The system design bible for software engineers. Learn to build reliable, scalable, and maintainable systems.
Common Causes
- Client explicitly requests a byte range using the 'Range' header.
- Resuming an interrupted download.
- Streaming media content (e.g., video or audio) where only a segment is needed.
- Fetching specific parts of a large file for display or processing.
Code Examples to Handle HTTP 206
curl -I https://httpbin.org/status/206
How to Fix It
- Verify the client's 'Range' header: Ensure it's correctly formatted (e.g., 'bytes=0-499' or 'bytes=500-').
- Check server-side support for 'Range' requests: Confirm that the server is configured to handle partial content requests and sends the 'Accept-Ranges' header.
- Examine the 'Content-Range' header in the server's response: This header should specify the byte range included in the response and the total size of the resource (e.g., 'Content-Range: bytes 0-499/1234').
- Ensure the requested range is valid: If the client requests a range outside the resource's bounds, the server might return 416 (Range Not Satisfiable).
Related Status Codes
Frequently Asked Questions
What causes HTTP 206?
HTTP 206 is caused by a client making a GET request for only a portion of a resource, typically by including a 'Range' header in its request. The server then successfully fulfills this partial request.
How do I fix HTTP 206?
HTTP 206 is generally not an error but an expected behavior. If you're a client developer, ensure your 'Range' headers are correct. If you're a server developer, ensure your server correctly processes 'Range' headers, sends 'Accept-Ranges', and responds with the appropriate 'Content-Range' header and the requested byte range.