Request headers
Authorization
How the client identifies itself — usually a Bearer token, Basic credentials, or an API key.
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...
💡 Despite the name, this often carries authentication, not authorisation. Server checks who you are, then decides what you can do.
Accept
What response formats the client can handle. Server picks one in Content-Type.
Accept: application/json, text/html;q=0.9
Accept-Language
What human languages the client prefers, with weights. Used for content negotiation.
Accept-Language: en-US,en;q=0.9,uk;q=0.8
Accept-Encoding
Which compression algorithms the client supports for the response body.
Accept-Encoding: gzip, br
Content-Type
The media type of the request body. Required when sending a body.
Content-Type: application/json; charset=utf-8
💡 Also used in responses to describe the body format.
User-Agent
String identifying the client software. Browsers, libraries, bots all send one.
User-Agent: Mozilla/5.0 (...) Chrome/120 Safari/537.36
Cookie
Cookies the browser is sending back to the server for this domain.
Cookie: session=abc123; theme=dark
Referer
The URL of the page that initiated the request. (Note the historic misspelling — it is "Referer", not "Referrer".)
Referer: https://example.com/products/
Origin
The scheme + host + port of the page making the request. Sent on cross-origin requests for CORS checks.
Origin: https://app.example.com
Range
Request only a byte range of the resource — used for video streaming, resumable downloads.
Range: bytes=0-1023
Response headers
Content-Length
Size of the response body in bytes. Lets the client know how much to read.
Content-Length: 4823
Set-Cookie
Server tells the browser to store a cookie. Can include flags like HttpOnly, Secure, SameSite.
Set-Cookie: session=abc; HttpOnly; Secure; SameSite=Lax; Path=/
Location
Where the client should redirect (3xx) or find a newly-created resource (201).
Location: /api/users/42
WWW-Authenticate
Sent with 401 Unauthorized — tells the client what auth scheme is required.
WWW-Authenticate: Bearer realm="api", error="invalid_token"
Retry-After
How long to wait before retrying. Sent with 429 (rate limit) or 503 (service unavailable).
Retry-After: 120
💡 Value is seconds or an HTTP-date.
X-Rate-Limit-*
Custom headers reporting rate-limit state. Conventional but not standardised — X-Rate-Limit-Limit, X-Rate-Limit-Remaining, X-Rate-Limit-Reset.
X-Rate-Limit-Remaining: 47
X-Rate-Limit-Reset: 1735689600
Caching (response side)
Cache-Control
The dominant caching directive. Controls how/whether responses are cached by browsers, CDNs, and proxies.
Cache-Control: public, max-age=31536000, immutable
💡 Common values: no-store (never cache), no-cache (cache but revalidate), max-age=N (cache N seconds), public (any cache), private (browser only).
ETag
An opaque token identifying the resource version. Used with If-None-Match for conditional GETs.
ETag: "abc123"
Last-Modified
When the resource last changed. Older alternative to ETag, paired with If-Modified-Since.
Last-Modified: Wed, 15 May 2026 12:00:00 GMT
Expires
Absolute date when the response becomes stale. Cache-Control max-age is preferred.
Expires: Thu, 16 May 2026 12:00:00 GMT
Vary
Tells caches which request headers affect the response. Without it, a cache might serve the wrong variant.
Vary: Accept-Encoding, Accept-Language
Security headers
Strict-Transport-Security
HSTS — tells the browser to use HTTPS for this domain for the given number of seconds, even if the user typed http://.
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Content-Security-Policy
CSP — controls what resources (scripts, styles, images) the browser is allowed to load. Strongest XSS defence in depth.
Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-abc123'
X-Content-Type-Options
Set to "nosniff" to prevent the browser from guessing a different content type than the server declared.
X-Content-Type-Options: nosniff
X-Frame-Options
Whether your page can be embedded in an iframe. Defends against clickjacking. Use DENY or SAMEORIGIN.
X-Frame-Options: DENY
💡 Superseded by CSP frame-ancestors, but many tools still set both.
Referrer-Policy
Controls how much of the referrer URL is sent on outbound links and requests.
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy
Controls which browser APIs (camera, microphone, geolocation, etc.) your page can use, and on which origins.
Permissions-Policy: camera=(), microphone=(), geolocation=(self)
CORS headers
Access-Control-Allow-Origin
Server's answer to cross-origin requests: which origins may read this response. The most-asked-about HTTP header on Stack Overflow.
Access-Control-Allow-Origin: https://app.example.com
💡 * allows any origin but disables credentials. Echo back the request Origin to allow specific origins with credentials.
Access-Control-Allow-Methods
Sent in preflight responses (200 OPTIONS) listing which HTTP methods are allowed cross-origin.
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers
Sent in preflight responses listing which request headers are allowed cross-origin.
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials
Whether the response may be exposed to JS when the request was made with credentials (cookies, Authorization).
Access-Control-Allow-Credentials: true
Access-Control-Max-Age
How long the browser may cache the preflight response. Avoids OPTIONS round trips.
Access-Control-Max-Age: 600