About Http Range Headers

Compiling hacks, tricks & bytes of information I learn everyday so others can benefit from it during tough times or otherwise.

Share:

Jan 29, 2026 432 Words

Read Time: 3 Minutes

Today I learned about the basics of HTTP range headers.

What are HTTP range headers?

They help HTTP clients request a part or several parts of the file content.

The client can control which segments of the resource files they want and the server that supports them can provide exactly that.

The client specifies the unit and the offset ranges based on the Content-Length that the server responds with.

To know if a client support partial responses (when range headers are used), the client can inspect for a certain HTTP response header from the server. Here’s an example:

Accept-Ranges: Bytes

If the server was able to process and server the requested content range, then the client can expect a HTTP status 206 Partial Content. Else if the server cannot process the provided range, the server responds with a 4XX (416 Range Not Satisfiable) response. This is also returned if the requested range is improper (like in reverse order of malfomed)

Here’s an example snippet taken and modified from the MDN1 documentation:

➜  ~ curl https://i.imgur.com/z4d4kWk.jpg -i -H "Range: bytes=0-10" --output -
HTTP/2 206
content-type: image/jpeg
last-modified: Thu, 02 Feb 2017 11:15:53 GMT
etag: "18c50e1bbe972bdf9c7d9b8f6f019959"
x-amz-storage-class: STANDARD_IA
x-amz-cf-pop: JFK50-P6
x-amz-cf-id: unKLSEZv6qx_gPITlFbtbFAvUFQO51rK6ZJKy9PiAUWwbUzjl2vacQ==
cache-control: public, max-age=31536000
accept-ranges: bytes
age: 1234174
content-range: bytes 0-10/146515
date: Thu, 29 Jan 2026 04:16:23 GMT
x-served-by: cache-iad-kcgs7200052-IAD, cache-rtm-ehrd2290043-RTM
x-cache: Miss from cloudfront, HIT, HIT
x-cache-hits: 69, 0
x-timer: S1769660183.126144,VS0,VE1
strict-transport-security: max-age=300
access-control-allow-methods: GET, OPTIONS
access-control-allow-origin: *
server: cat factory 1.0
x-content-type-options: nosniff
content-length: 11

����C%

Some servers like imgur return the whole content (200 OK) if the requested range is improper.

curl https://i.imgur.com/z4d4kWk.jpg -i -H "Range: bytes=10-0" --output - | head -25
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
HTTP/2 200
content-type: image/jpeg
last-modified: Thu, 02 Feb 2017 11:15:53 GMT
etag: "18c50e1bbe972bdf9c7d9b8f6f019959"
x-amz-storage-class: STANDARD_IA
x-amz-cf-pop: JFK50-P6
x-amz-cf-id: unKLSEZv6qx_gPITlFbtbFAvUFQO51rK6ZJKy9PiAUWwbUzjl2vacQ==
cache-control: public, max-age=31536000
accept-ranges: bytes
age: 1234395
date: Thu, 29 Jan 2026 04:20:04 GMT
x-served-by: cache-iad-kcgs7200052-IAD, cache-rtm-ehrd2290050-RTM
x-cache: Miss from cloudfront, HIT, HIT
x-cache-hits: 69, 0
x-timer: S1769660404.111650,VS0,VE1
strict-transport-security: max-age=300
access-control-allow-methods: GET, OPTIONS
access-control-allow-origin: *
server: cat factory 1.0
x-content-type-options: nosniff
content-length: 146515

����C






 21  143k   21 31416    0     0  26364      0  0:00:05  0:00:01  0:00:04 26377
curl: (56) Failure writing output to destination, passed 1209 returned 0

These headers won’t probably be useful in day to day uses of the HTTP protocol, but they’re something that one can use during multimedia streaming or supporting pausing and resuming downloads on static files (usually large ones).

👋 ⸻ @TnvMadhav

Few more issues:

Find more posts from following topics

1
10
11
12
13
14
15
16
17
18
19
2
20
2024
2025
2026
21
22
23
24
25
26
27
28
29
3
30
31
4
5
6
7
8
9
@binding
abbacchio
accurate requests
anime
api development
api testing
api testing tools
apple
april
arm
array
august
automated testing
bad habits
base64 decoder
base64 encoder
bash
biography
blog
blogging
books
browser
bulma css
bulma.io
bulmacss
button swiftui
chatgpt
chrome
clipboard
code
code block
code navigation
code snippet
code-review
codecoverage
comparison
compile
computer networks
configuring debugger for django in vs code
configuring launch.json for python debugger
copy
copy to clipboard
copy to clipboard neovim
css
current date
current time
current timestamp
database
debugger setup in visual studio code
debugging
debugging django app in visual studio code
debugging python code in visual studio code
debugging python programs with visual studio code
debugging python with virtual environment in vs code
december
developer productivity
developers
development
development workflow
django
django rest framework
dom
dynamic sitemap in nextjs
editor
encryption
engineering dashboard
enumerate
experience
february
fiction
flowcharts
fzf
generics
git
git diff
github
global keyboard shorcut
global shortcut
go hugo
go programming
go test
go to line
go tool
go1.18
golang
golang development
golden wind
good habits
gorilla websocket
gpt
gpt-3.5
gpt-4
gpt-4 api
guide
gumroad
habits
habits tracker notion template
hamburger menu
har
hotkeys
html
http
http-archive
hugo
ide
image
image sharing
image tool for ios
imagerenderer
include timestamp
integrated development environment
intel
ios
ios 16
ios16
iphone
iphone 13
iphone 13 pro
iphone 13 pro max
january
javascript
jojo's bizzarre adventure
july
jump to definition
june
keyboard shortcut
leonardo da vinci
lessons
linux
logging
ls
lsp
macos
map
march
markdown
markdown code
may
mental programming
menu
menubarextra
mergesort
mermaid syntax
mistake tracker notion
mobile view
modifier
modulo operation
navbar
navigationlink
navigationstack
neovim
nested functions
next.js
nextjs
nextjs markdown
nextjs sitemap
nextjs sitemaps
nice shot
nice shot pro
notion
notion api
notion api python
notion budget
notion budget template
notion budget tracker
notion bug report tracker
notion dashboard
notion expense manager
notion habits
notion habits dashboard
notion habits template
notion habits tracker
notion habits tracker template
notion issue tracker
notion mistake tracker
notion product
notion product dashboard
notion product roadmap
notion product roadmap dashboard
notion tasks
notion tasks dashboard
notion tasks template
notion tasks tracker
notion template
notionworkspaces
november
october
openai
osx
pagination
personal ifttt framework
photospicker
photospickeritem
phpickerfilter
postgres
postman capabilities
postman request
powerpc
pre-request script
product roadmap notion template
product roadmap template
productivity
productivty
programming
python
python api
python debugger tutorial for vs code
python debugging mode in vs code
python notion api
python3
reading
real time communication
rehype
remark
request data
rosetta
running debugger in visual studio code
running django app in debugging mode
running program in debugging mode in vs code
running python code in debugging mode
safari
screenshot app for ios
screenshot app ios
screenshot ios
screenshot tool for ios
september
set current timestamp
setting up debugger in vs code for python
share extension
sharelink
sharepreview
sharesheet
simple websocket server
sitemap
slice
slices
slider
sort
sorting
space complexity
sql
ssh
step-by-step guide
stocks profits tracker
stocks profits tracker template
stocks tracker
struct
sustained vigilance
swift
swiftui
swiftui button
swiftui button action
swiftui button style
table of contents
tasks tracker notion template
tcp
test
testing
textfield swiftui
til
tim-sort
time complexity
timeliness
timestamp integration
timsort
transferable
triggers and actions
tutorial
unittest
unix
us stocks
usa stocks
useful ios features
using breakpoints in python debugger
using virtual environment with python debugger
vanilla javascript
variable
vim
visual mode
visual studio code
vs code
vscode
vscode go to line
walter isaacson
web sockets in go
websocket client
websocket programming
websocket server
white screen of death
wsod
x86
xcode
xss
zsh