HTTP headers: labels that change the outcome
03Attach labels to a message, then watch a reader choose a format, count bytes, save a copy, check a version or decide who may read it.
Start with the content and the reader’s goal.
Send the word Sun with a label that explains what it is.
Choose an example below, then use Next to follow the labels.
Change the labels
Changing an input returns to the beginning. Restart restores this story’s original choices.
These examples stay on this page. No requests, credentials or cookies are sent or stored. The selected server policies are stated; real implementations need the complete field rules. Space plays or pauses; Next, Previous and Restart follow the active scene.
Find a header by its job · 35 selected fields
Header fields are named labels separate from content. This is a curated starting map, not every registered header. Headers live in several standards. Open a field’s source for its full syntax, direction and limits.
| Field and source | Job | What it means |
|---|---|---|
| Content-Type ↗ Explain Content-Type | Content description | Names the format of this content. It does not convert the bytes. |
| Content-Length ↗ Explain Content-Length | Content description | Counts content octets, with special rules for HEAD, 304 and replies with no content. |
| Content-Encoding ↗ Explain Content-Encoding | Content description | Names a coding such as gzip already applied to the representation. |
| Content-Language ↗ Explain Content-Language | Content description | Identifies the intended audience’s language, not necessarily every language present. |
| Content-Disposition ↗ Explain Content-Disposition | Content handling | Can suggest inline display or attachment handling and a filename. |
| Accept ↗ Explain Accept | Request preference | Lists acceptable response media types; selection is still the server’s job. |
| Accept-Language ↗ Explain Accept-Language | Request preference | Expresses preferred audience languages. |
| Accept-Encoding ↗ Explain Accept-Encoding | Request preference | Expresses acceptable content codings. |
| Vary ↗ Explain Vary | Saved response selection | Names request fields that helped select the response. |
| Cache-Control ↗ Explain Cache-Control | Saving and reuse | Carries cache directives; no-cache and no-store do different jobs. |
| Age ↗ Explain Age | Saving and reuse | Estimates seconds since the response was generated or successfully validated. |
| Date ↗ Explain Date | Saving and reuse | Gives the message’s origination date and time. |
| Expires ↗ Explain Expires | Saving and reuse | Gives a freshness expiry time; applicable max-age overrides it. |
| ETag ↗ Explain ETag | Comparing versions | An opaque representation tag; do not infer a timestamp or hash from its spelling. |
| Last-Modified ↗ Explain Last-Modified | Comparing versions | Reports when the origin believes the representation was last modified. |
| If-None-Match ↗ Explain If-None-Match | Request condition | GET can avoid transferring matching content; other methods have different outcomes. |
| If-Match ↗ Explain If-Match | Request condition | Requires a strong matching tag before applying the method. |
| If-Modified-Since ↗ Explain If-Modified-Since | Request condition | A time-based conditional GET or HEAD. |
| Authorization ↗ Explain Authorization | Credential | Carries credentials for origin authentication; not a permission guarantee. |
| WWW-Authenticate ↗ Explain WWW-Authenticate | Credential | Describes an origin authentication challenge. |
| Cookie ↗ Explain Cookie | State | Sends selected stored cookie name/value pairs to a server. |
| Set-Cookie ↗ Explain Set-Cookie | State | Asks the browser to store one cookie with scope and attributes. Keep separate field lines. |
| Location ↗ Explain Location | Follow-up | Identifies a resource related to a response; its role depends on the status and method. |
| Retry-After ↗ Explain Retry-After | Follow-up | Suggests a delay or time before a follow-up; does not promise success. |
| Allow ↗ Explain Allow | Capabilities | Lists methods supported by this target; does not grant permission. |
| Range ↗ Explain Range | Partial content | Requests part of a representation; the server can ignore it. |
| Content-Range ↗ Explain Content-Range | Partial content | Describes the returned interval and possibly the whole size. |
| Connection ↗ Explain Connection | HTTP/1.1 forwarding | Identifies options for this connection; nominated fields are removed before forwarding. |
| Via ↗ Explain Via | Forwarding | Records intermediary protocol recipients. |
| Host ↗ Explain Host | Routing | Carries target authority information; not a user identity. |
| Origin ↗ Explain Origin | Browser sharing | Identifies the request’s origin in CORS exchanges. |
| Access-Control-Allow-Origin ↗ Explain Access-Control-Allow-Origin | Browser sharing | Controls which requesting origins can read a CORS response. |
| Access-Control-Allow-Credentials ↗ Explain Access-Control-Allow-Credentials | Browser sharing | The value true permits sharing when credentials mode is include, subject to other checks. |
| Strict-Transport-Security ↗ Explain Strict-Transport-Security | Browser policy | An HTTPS response can tell the browser to use HTTPS for later visits. |
| Content-Security-Policy ↗ Explain Content-Security-Policy | Browser policy | Restricts what a protected document may load or execute. |
Explore CSP directives ↗ · MDN · broader header reference ↗ · IANA · registered HTTP fields ↗
Names are case-insensitive, but values follow each field’s own rules. Do not blindly comma-join repeated fields: Set-Cookie is a familiar exception. These decoded sketches are not complete wire messages. HTTP/2 and HTTP/3 use lowercase field names and binary framing; HTTP/1.1 line formatting is not universal. Browsers control some fields rather than allowing page code to set them freely.
The client uses metadata rather than guessing the meaning of arbitrary bytes.
Key idea: Headers are named labels sent with a message. Each field has its own meaning; the content is a separate part.
Terms
- Client / user agent
- The app making a request; in this example, your browser.
- Origin server
- The server responsible for providing an answer for the target resource.
- Request
- A message asking for an action on a resource.
- Response
- The server’s message reporting the result of a request.
- Resource
- Something identified by a URI, such as the page at /story.
- Representation
- Content and descriptive information that convey a resource’s state, such as an HTML page.
- Semantics
- What a message or protocol element means, independently of how it travels.
- Metadata
- Information describing content, such as its type, language or encoding.
- Content-Type
- A field naming the format of the content, such as text/html.
- Content-Encoding
- A field describing a coding applied to the representation, such as gzip compression.
- Content-Length
- A field expressing a length in bytes under HTTP’s message rules.
- Trailer
- A field sent after the content, subject to restrictions.
- media type
- A format label telling a reader how content is meant to be interpreted.
- charset
- A label identifying the rules used to turn text characters into bytes and back.
- content coding
- A reversible way of transforming representation data for transfer or storage.
- gzip
- A format for packing data using compression so it can be unpacked later.
- CSRF
- An attack that tricks a browser into sending an unwanted request using the victim’s existing access.
- Content-Language
- Identifies the intended audience’s language, not necessarily every language present.
- Content-Disposition
- Can suggest inline display or attachment handling and a filename.
- Accept
- Lists acceptable response media types; selection is still the server’s job.
- Accept-Language
- Expresses preferred audience languages.
- Accept-Encoding
- Expresses acceptable content codings.
- Vary
- Names request fields that helped select the response.
- Cache-Control
- Carries cache directives; no-cache and no-store do different jobs.
- Age field
- Estimates seconds since the response was generated or successfully validated.
- Date field
- Gives the message’s origination date and time.
- Expires field
- Gives a freshness expiry time; applicable max-age overrides it.
- ETag
- An opaque representation tag; do not infer a timestamp or hash from its spelling.
- Last-Modified
- Reports when the origin believes the representation was last modified.
- If-None-Match
- GET can avoid transferring matching content; other methods have different outcomes.
- If-Match
- Requires a strong matching tag before applying the method.
- If-Modified-Since
- A time-based conditional GET or HEAD.
- Authorization field
- Carries credentials for origin authentication; not a permission guarantee.
- WWW-Authenticate
- Describes an origin authentication challenge.
- Cookie field
- Sends selected stored cookie name/value pairs to a server.
- Set-Cookie
- Asks the browser to store one cookie with scope and attributes. Keep separate field lines.
- Location
- Identifies a resource related to a response; its role depends on the status and method.
- Retry-After
- Suggests a delay or time before a follow-up; does not promise success.
- Allow field
- Lists methods supported by this target; does not grant permission.
- Range field
- Requests part of a representation; the server can ignore it.
- Content-Range
- Describes the returned interval and possibly the whole size.
- Connection field
- Identifies options for this connection; nominated fields are removed before forwarding.
- Via field
- Records intermediary protocol recipients.
- Host field
- Carries target authority information; not a user identity.
- Origin field
- Identifies the request’s origin in CORS exchanges.
- Access-Control-Allow-Origin
- Controls which requesting origins can read a CORS response.
- Access-Control-Allow-Credentials
- The value true permits sharing when credentials mode is include, subject to other checks.
- Strict-Transport-Security
- An HTTPS response can tell the browser to use HTTPS for later visits.
- Content-Security-Policy
- Restricts what a protected document may load or execute.
- header field
- A named piece of information sent with a request or response, separate from its content.
- field name
- The part of a message label that identifies which rule its value follows.
- field value
- The information attached to one named message label.
- private cache
- A saved-response store intended for one user, such as a browser’s HTTP cache.
- current age
- An estimate of how many seconds old a saved response is now.
- no-cache
- A cache instruction that requires successful checking before a saved response can be reused.
- no-store
- A cache instruction saying not to save this request and response for later cache reuse.
- opaque tag
- A comparison label whose internal spelling the receiver should not interpret.
- HttpOnly
- A cookie attribute that hides that cookie from ordinary page-script cookie access.
- credentials mode
- A Fetch setting controlling credential use and the rules for sharing a response with page code.
- preflight
- A browser permission check sent before certain cross-origin requests.
- octet
- One eight-bit byte: a small unit used to count or carry data.
Rules & examples
Headers are named labels sent with a message. Each field has its own meaning; the content is a separate part.
- Content-Type identifies the media type; Content-Encoding describes representation codings.
- Content-Length must agree with its defined meaning and framing constraints.
- Field names are case-insensitive; trailers have additional restrictions on permitted use and merging.
These decoded sketches show selected fields, not full wire messages. Server choices, cache state, cookie scope and credential checks are explicit offline examples. No real cookies or requests are created. Browser sharing checks do not replace server permission checks. A curated field map links the full standards.
Predict: Does Cache-Control: no-cache mean a browser cannot save the response?
Check your answer
No. Unqualified no-cache permits storage but requires successful validation before reuse. no-store prohibits storing this request and response for later cache reuse.
Sources
New to this? Start hereA quick picture + helpful background
A request starts a conversation.
A client asks for a resource. A server sends a response. The method, address, headers, and status explain what that conversation means.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.