HTTP Headers Reference

Look up what a request or response header does, with a working example value for each. Search by name or by job (cache, cors, cookie, redirect), or open one section such as Security or Caching. Every example can be copied.

Section

56 entries

Content and negotiation

What the body is, and what the client is willing to accept back.

Content-Type
Both

Media type of the body, with an optional charset or multipart boundary. Servers use it to pick a parser; browsers use it to decide how to render.

Content-Type: application/json; charset=utf-8
Content-Length
Both

Size of the body in bytes (not characters). Set automatically by most clients and servers.

Content-Length: 348
Content-Encoding
Both

Compression applied to the body. The receiver must decompress before reading it.

Content-Encoding: gzip
Content-Disposition
Response

Whether the browser shows the body inline or downloads it, and the suggested file name. Also names each part in multipart form data.

Content-Disposition: attachment; filename="invoice-0425.pdf"
Content-Language
Both

Language of the content meant for the reader.

Content-Language: hi-IN
Accept
Request

Media types the client can handle, with optional q weights. APIs use it to choose JSON, XML or CSV.

Accept: application/json, text/plain;q=0.8
Accept-Encoding
Request

Compression formats the client understands. Browsers send it for you.

Accept-Encoding: gzip, deflate, br, zstd
Accept-Language
Request

Preferred languages in order. Sites use it to choose a default language.

Accept-Language: en-IN, hi;q=0.8, en;q=0.6
Vary
Response

Request headers that changed the response. Caches store a separate copy per value, so a wrong Vary can serve one user’s page to another.

Vary: Accept-Encoding, Accept-Language

Authentication and cookies

Authorization
Request

Credentials for the request: a Bearer token, Basic user:password in Base64, or a signed scheme. Never log it.

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
WWW-Authenticate
Response

Sent with 401 Unauthorized to say which auth scheme the server expects.

WWW-Authenticate: Bearer realm="api", error="invalid_token"
Proxy-Authorization
Request

Credentials for a proxy in between, not for the final server.

Proxy-Authorization: Basic dXNlcjpwYXNz
Cookie
Request

Cookies the browser stored for this site, sent back on every matching request.

Cookie: session=4f2a9c; theme=dark
Set-Cookie
Response

Stores a cookie. Use HttpOnly so scripts cannot read it, Secure for HTTPS only, and SameSite to limit cross-site sending.

Set-Cookie: session=4f2a9c; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=86400
X-API-Key
Request

A common, non-standard header for API keys. The exact name differs per provider; check their docs.

X-API-Key: sk_live_...

Caching and conditional requests

Cache-Control
Both

Caching rules. no-store: never cache. no-cache: cache but revalidate first. max-age: seconds a copy stays fresh. public / private: shared caches allowed or not.

Cache-Control: public, max-age=31536000, immutable
ETag
Response

A version tag for the resource. The client sends it back in If-None-Match to ask whether it changed.

ETag: "33a64df5"
If-None-Match
Request

Returns 304 Not Modified (no body) if the ETag still matches, saving bandwidth.

If-None-Match: "33a64df5"
Last-Modified
Response

When the resource last changed. Weaker than ETag (one-second resolution).

Last-Modified: Tue, 01 Dec 2026 06:30:00 GMT
If-Modified-Since
Request

Returns 304 if the resource has not changed since this date.

If-Modified-Since: Tue, 01 Dec 2026 06:30:00 GMT
If-Match
Request

Only perform the update if the ETag still matches; otherwise 412 Precondition Failed. Prevents lost updates when two people edit at once.

If-Match: "33a64df5"
Expires
Response

Older way to set a freshness deadline. Cache-Control max-age wins when both are present.

Expires: Wed, 02 Dec 2026 06:30:00 GMT
Age
Response

Seconds the response has spent in a shared cache such as a CDN.

Age: 1200

CORS (cross-origin requests)

Browsers enforce these; curl and server-to-server calls ignore them.

Origin
Request

Scheme, host and port of the page making the request. Sent by browsers on cross-origin and POST requests.

Origin: https://shop.example.in
Access-Control-Allow-Origin
Response

Which origin may read the response: one exact origin, or * for public data. * cannot be used with credentials.

Access-Control-Allow-Origin: https://shop.example.in
Access-Control-Allow-Methods
Response

Methods allowed for the actual request, sent in reply to a preflight OPTIONS.

Access-Control-Allow-Methods: GET, POST, PATCH, DELETE
Access-Control-Allow-Headers
Response

Request headers the browser may send, such as Authorization or Content-Type: application/json.

Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Credentials
Response

Lets the browser send cookies and expose the response to the page. Needs an exact origin, not *.

Access-Control-Allow-Credentials: true
Access-Control-Max-Age
Response

Seconds the browser may cache the preflight result, so it stops sending OPTIONS each time.

Access-Control-Max-Age: 600
Access-Control-Expose-Headers
Response

Response headers page scripts may read beyond the basic safe list (for example a rate-limit header).

Access-Control-Expose-Headers: X-RateLimit-Remaining

Security

Strict-Transport-Security
Response

Tells browsers to use HTTPS only for this host for max-age seconds (HSTS). Only sent over HTTPS.

Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Content-Security-Policy
Response

Allow-list of where scripts, styles, images and frames may load from. The strongest defence against injected scripts (XSS).

Content-Security-Policy: default-src 'self'; img-src 'self' data:; frame-ancestors 'none'
X-Content-Type-Options
Response

nosniff stops browsers guessing a different type than Content-Type says.

X-Content-Type-Options: nosniff
X-Frame-Options
Response

Whether other sites may put your page in a frame (clickjacking). CSP frame-ancestors is the modern replacement.

X-Frame-Options: DENY
Referrer-Policy
Response

How much of the current URL is sent as Referer when users follow a link.

Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy
Response

Turns browser features such as camera, microphone or geolocation on or off for the page and its frames.

Permissions-Policy: camera=(), microphone=(self), geolocation=()
Cross-Origin-Opener-Policy
Response

Isolates your window from pop-ups of other origins. Needed, with COEP, for SharedArrayBuffer.

Cross-Origin-Opener-Policy: same-origin

Routing, proxies and redirects

Host
Request

Domain (and port) the request is for. Lets one server host many sites. Required in HTTP/1.1.

Host: api.example.in
Location
Response

Where to go next: the redirect target on 301/302/307/308, or the new resource on 201 Created.

Location: https://example.in/new-path
X-Forwarded-For
Request

Client IP chain added by proxies and load balancers. Trust only the entries your own proxy added; clients can fake the rest.

X-Forwarded-For: 203.0.113.7, 10.0.0.2
X-Forwarded-Proto
Request

Protocol the client used (http or https) before a TLS-terminating proxy.

X-Forwarded-Proto: https
Forwarded
Request

Standard (RFC 7239) form of the X-Forwarded-* headers.

Forwarded: for=203.0.113.7;proto=https;host=example.in
Referer
Request

Page the request came from (spelled with one r in HTTP). Limited by Referrer-Policy.

Referer: https://example.in/pricing
User-Agent
Request

Client software and version. Useful in logs; unreliable for feature detection.

User-Agent: curl/8.7.1

Connections, ranges and rate limits

Connection
Both

HTTP/1.1 only: keep-alive or close. Not allowed in HTTP/2 and HTTP/3.

Connection: keep-alive
Transfer-Encoding
Response

chunked sends the body in pieces when the length is not known up front (HTTP/1.1).

Transfer-Encoding: chunked
Range
Request

Asks for part of a file, for resumable downloads and video seeking. The server answers 206 Partial Content.

Range: bytes=0-1048575
Accept-Ranges
Response

Says the server supports byte ranges.

Accept-Ranges: bytes
Content-Range
Response

Which bytes this partial response holds, out of the total.

Content-Range: bytes 0-1048575/5242880
Retry-After
Response

Seconds (or a date) to wait before retrying, sent with 429 Too Many Requests or 503.

Retry-After: 120
RateLimit-Limit / X-RateLimit-Remaining
Response

Request quota headers used by many APIs. Names vary (an IETF draft standardises RateLimit-*); read them to slow down before you hit 429.

X-RateLimit-Remaining: 42
Expect
Request

100-continue asks the server to approve headers before a large body is sent. curl adds it for big uploads.

Expect: 100-continue

Webhooks and request IDs

X-Request-ID
Both

A unique ID per request, passed through services and logs so one request can be traced end to end.

X-Request-ID: 7f3c1a9e-2b4d-4c55-9a10-0e6f2d8b1c44
Idempotency-Key
Request

A unique key per payment or order so retrying after a timeout does not charge twice. Supported by many payment APIs.

Idempotency-Key: order-2026-0425-retry
X-Hub-Signature-256
Request

HMAC-SHA256 of the webhook body, as sent by GitHub and Meta. Verify it before trusting the payload.

X-Hub-Signature-256: sha256=6f1e...
X-Razorpay-Signature
Request

HMAC-SHA256 (hex) of the raw webhook body with your webhook secret, sent by Razorpay.

X-Razorpay-Signature: 2e7c...

Features

  • 56 headers in eight sections, each marked Request, Response or Both

  • Plain explanations with the gotchas that cause real bugs

  • A copyable example value for every header

  • CORS, caching and security headers explained together, the way you debug them

  • Webhook signature and idempotency headers used by payment and messaging APIs

  • Instant search by header name or by what you are trying to do

When you need this list

Debugging CORS errors

See which Access-Control-* header the browser is waiting for, and why * does not work with cookies.

Setting cache rules

Choose between no-store, no-cache and max-age, and see how ETag and If-None-Match save bandwidth.

Hardening a site

Check the security headers a scanner flagged, with safe starting values for HSTS, CSP and Referrer-Policy.

Building an API or webhook

Pick the right status-related headers (Location, Retry-After) and the signature and request-ID headers your consumers expect.

Reading headers in practice

Where to see them

  • Browser: DevTools, Network tab, click a request, Headers.
  • Terminal: curl -i shows response headers with the body; curl -v shows both directions.
  • Header names are case-insensitive. HTTP/2 and HTTP/3 send them in lower case.

Custom headers

The X- prefix for custom headers is no longer recommended (RFC 6648), but many APIs still use names like X-API-Key and X-Request-ID, so you will keep seeing them. For your own APIs, a clear name without X- is fine.

HTTP Headers Reference - FAQ