HTTP Headers
HTTP headers are a means for a client, server, and any intermediaries to exchange information during the HTTP request-response process.
- Usage
- HTTP header categories and names
- Authentication
- Caching
- Client Hints
- Network client hints
- Conditionals
- Connection Management
- Content negotiation
- Controls
- Cookies
- CORS
- Downloads
- Message body information
- Proxies
- Redirects
- Request context
- Response context
- Range requests
- Security
- Fetch metadata request headers
- Server-Sent events
- Transfer coding
- WebSockets
- Other
- Takeaway
Usage
HTTP headers are a pillar of HTTP messages. Servers and clients alike rely on the information exchanged in HTTP headers regardless of whether they are in the HTTP request or HTTP response. There are HTTP request-specific headers that might contain information about the client, HTTP response-specific headers that may contain details about the host, and HTTP headers that are common on both sides of the conversation. A representational HTTP header, for example, contains information about the body of the resource such as how it is encoded. There are also payload headers, which hold representation-independent information such as the size of the message body.
HTTP headers can be further characterized by their scope within the message chain. An end-to-end header that is sent by the client must be transmitted to the server, unmodified by intermediaries, and stored by caches as appropriate. Conversely, a hop-by-hop header is only relevant between nodes, and as such, not forwarded or stored by caches.
There are many different types of HTTP headers that describe or govern processes such as authentication, caching, message body information, and proxies. For example, Cookies are transmitted via HTTP headers, and they are responsible for maintaining the current client’s state in a stateless system.
HTTP header categories and names
Authentication
Caching
Client Hints
Network client hints
Conditionals
Connection Management
Content negotiation
Controls
Cookies
CORS
- Access-Control-Allow-Origin
- Access-Control-Allow-Credentials
- Access-Control-Allow-Headers
- Access-Control-Expose-Headers
- Access-Control-Max-Age
- Access-Control-Request-Headers
- Access-Control-Request-Method
- Timing-Allow-Origin
Downloads
Message body information
Proxies
Redirects
Request context
Response context
Range requests
Security
- Cross-Origin-Embedder-Policy (COEP)
- Cross-Origin-Opener-Policy (COOP)
- Cross-Origin-Resource-Policy (CORP)
- Content-Security-Policy (CSP)
- Content-Security-Policy-Report-Only
- Expect-CT
- Strict-Transport-Security (HSTS)
- Upgrade-Insecure-Requests
- X-Content-Type-Options
- X-Frame-Options
- X-Powered-By
- X-XSS-Protection
Fetch metadata request headers
Server-Sent events
Transfer coding
WebSockets
Other
- Alt-Svc
- Date
- Link
- Retry-After
- Server-Timing
- Sourcemap
- Upgrade
- X-DNS-Prefetch-Control
- X-Request-ID
- X-Robots-Tag
- X-UA-Compatible
Takeaway
HTTP headers are part of the HTTP messaging architecture, with both client and server relying on them for information, direction, and general assistance.