HTTP Headers Reference

HTTP headers are key-value metadata carried in requests and responses. This table lists the most common request and response headers with kind and notes for quick lookup while debugging APIs.

HeaderKindMeaning
AcceptRequestMedia types the client can handle (e.g. application/json, text/html)
Accept-EncodingRequestAcceptable compression (gzip, br, deflate)
Accept-LanguageRequestPreferred natural languages and weights (e.g. zh-CN,en;q=0.8)
AuthorizationRequestAuth credential, e.g. Bearer <token> or Basic <base64>
Cache-ControlGeneralCache directives (no-cache, max-age=3600, private)
CookieRequestCookies set by server via Set-Cookie
Content-TypeGeneralMedia type of request or response body (e.g. application/json; charset=utf-8)
HostRequestTarget host and port, required by HTTP/1.1
OriginRequestSource origin for cross-origin requests, used in CORS
RefererRequestURL of the page making the request (spelled Referer)
User-AgentRequestClient software identifier (browser / crawler / lib name & version)
If-None-MatchRequestConditional request; carries last ETag for cache validation
If-Modified-SinceRequestConditional request; return only if modified after this time
Access-Control-Allow-OriginResponseCORS allowed origin (* or specific)
Content-LengthResponseByte length of the response body
Content-EncodingResponseCompression applied to response body (gzip, br)
Set-CookieResponseServer issues cookie, may set HttpOnly/Secure/SameSite
ETagResponseVersion identifier of the resource for cache validation
Last-ModifiedResponseLast modification time of the resource
LocationResponseTarget URL for 3xx redirect
ExpiresResponseAbsolute expiry time (superseded by Cache-Control)
ServerResponseServer software name and version
WWW-AuthenticateResponseAuth challenge on 401 (e.g. Basic)
Retry-AfterResponseSuggested retry delay in seconds on 503/429
Strict-Transport-SecurityResponseHSTS, force HTTPS for future requests
ConnectionGeneralConnection management (keep-alive or close)
DateGeneralMessage generation date-time (GMT)

Frequently Asked Questions

What is the difference between request and response headers?

Request headers are sent by the client (Accept, Authorization, Cookie) telling the server what it wants and who it is. Response headers come from the server (Content-Type, Set-Cookie, Cache-Control) describing what was returned and how to handle it. Some headers like Content-Type and Cache-Control appear on both sides.

What are common Cache-Control directives?

no-store (never cache), no-cache (revalidate), max-age=seconds (freshness lifetime), public/private (proxy-cacheable), must-revalidate (revalidate after expiry).

Which headers relate to CORS?

On the request side Origin; on the response side Access-Control-Allow-Origin (allowed origin), Access-Control-Allow-Methods, Access-Control-Allow-Headers, and Access-Control-Allow-Credentials.

How do ETag and Last-Modified work with caching?

Both are validators. The client stores the ETag/Last-Modified from the first response and sends If-None-Match/If-Modified-Since on later requests; if unchanged the server returns 304 Not Modified and the client reuses the cache, saving bandwidth.