On this page

General

HeaderDirectionPurpose
HostRequestTarget host and port. Required in HTTP/1.1.
User-AgentRequestIdentifies the client software.
DateBothTime the message was originated.
ConnectionBothkeep-alive or close. Mostly obsoleted by HTTP/2 framing.
ServerResponseIdentifies the server software. Often omitted for security.

Content

HeaderDirectionPurpose
Content-TypeBothThe MIME type of the body, e.g. application/json; charset=utf-8.
Content-LengthBothBody length in bytes.
Content-EncodingResponseCompression applied: gzip, br, zstd.
Content-LanguageResponseNatural language of the content.
Content-DispositionResponseattachment; filename="report.pdf" triggers a download dialog.
AcceptRequestAcceptable response media types.
Accept-EncodingRequestCompression algorithms the client supports.
Accept-LanguageRequestPreferred natural languages.

Caching

HeaderDirectionPurpose
Cache-ControlBothDirectives like no-store, private, max-age=…, immutable.
ETagResponseOpaque identifier for the current representation. Use with If-None-Match.
Last-ModifiedResponseModification timestamp. Use with If-Modified-Since.
VaryResponseList of request headers that affect the response — caches use it to vary entries.
AgeResponseTime in seconds the response has been in a cache.
Cache-Control: public, max-age=31536000, immutable

Conditional

HeaderDirectionPurpose
If-MatchRequestPerform the action only if the resource matches an ETag.
If-None-MatchRequestPerform only if the ETag does not match — used with caches.
If-Modified-SinceRequestPerform only if modified since a given date.
If-Unmodified-SinceRequestPerform only if not modified since a given date.

CORS

HeaderDirectionPurpose
OriginRequestThe origin initiating the cross-site request.
Access-Control-Allow-OriginResponseEcho the origin (or *) to permit it.
Access-Control-Allow-MethodsResponse (preflight)Methods permitted for the resource.
Access-Control-Allow-HeadersResponse (preflight)Headers the client may send.
Access-Control-Allow-CredentialsResponsetrue to allow cookies / Authorization across origins.
Access-Control-Max-AgeResponse (preflight)Seconds to cache the preflight result.

See CORS Explained for a walk-through.

Cookies

HeaderDirectionPurpose
Set-CookieResponseSet a cookie. Attributes: HttpOnly, Secure, SameSite, Domain, Path, Expires, Max-Age.
CookieRequestCookies previously set by the server.
Set-Cookie: session=abc123; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=86400

Security

HeaderDirectionPurpose
Strict-Transport-SecurityResponseForce HTTPS for a duration. max-age=31536000; includeSubDomains; preload.
Content-Security-PolicyResponseLimit the resources the page can load. See CSP.
X-Content-Type-OptionsResponsenosniff — disable MIME type guessing.
Referrer-PolicyResponseControl how much of the Referer header is sent on outgoing requests.
X-Frame-OptionsResponseDENY or SAMEORIGIN — clickjacking defense (largely superseded by CSP frame-ancestors).
Permissions-PolicyResponseSelectively enable or disable browser features.

Authentication

HeaderDirectionPurpose
AuthorizationRequestBearer <token>, Basic <b64>, or scheme-specific value.
WWW-AuthenticateResponse (401)Challenge scheme(s) the server accepts.
Proxy-AuthorizationRequestCredentials for an HTTP proxy.