HTTP Headers Reference

A practical guide to common HTTP headers used for auth, caching, security, and content negotiation.

General Headers

Key / CodeDescription
DateTimestamp when the message was generated.
ConnectionControl connection options like keep-alive.
Transfer-EncodingSpecify transfer encodings such as chunked.
UpgradeRequest protocol upgrade (e.g., WebSocket).
ViaTrack proxies/gateways between client and server.

Request Headers

Key / CodeDescription
AcceptMedia types acceptable for the response.
Accept-EncodingSupported compression (gzip, br).
AuthorizationCredentials for authenticating a user agent.
Content-TypeMedia type of the request body.
User-AgentClient identifier string.
OriginOrigin of the request (CORS).

Response Headers

Key / CodeDescription
Content-TypeMedia type of the response body.
Set-CookieSet a cookie on the client.
LocationRedirect target for 3xx responses.
WWW-AuthenticateAuth challenge for 401 responses.
ServerServer software identifier.

Caching Headers

Key / CodeDescription
Cache-ControlCaching directives (max-age, no-store).
ETagResource version identifier for validation.
Last-ModifiedLast modification date for conditional requests.
If-None-MatchValidate cache using ETag.
ExpiresAbsolute expiry time for cache.
VaryCache key based on request headers.

Security Headers

Key / CodeDescription
Strict-Transport-SecurityEnforce HTTPS for future requests.
Content-Security-PolicyRestrict resource loading to reduce XSS.
X-Content-Type-OptionsPrevent MIME sniffing (nosniff).
X-Frame-OptionsMitigate clickjacking (DENY/SAMEORIGIN).
Referrer-PolicyControl referrer information in requests.
Permissions-PolicyEnable/disable browser features.

How to Read Headers Quickly

Group headers by responsibility: request context, response metadata, cache behavior, and browser security. In debugging sessions, check Content-Type and Cache-Control first, then look at validators such as ETag and Last-Modified, and finally inspect security headers such as CSP or HSTS when browser behavior looks inconsistent.

Common Header Mistakes

A frequent mistake is setting Cache-Control without Vary, which can cause the wrong response variant to be cached. Another is mixing CORS response headers with the wrong Origin handling. On the security side, partial CSP rules often look valid but still allow unsafe inline behavior because the policy is incomplete.

Related

Knowledge is power.