HTTP Headers Reference
Searchable HTTP headers reference organized by category. Covers request, response, caching, security, and CORS headers with syntax and examples.
Last updated:
How to Use
Expand how to useCollapse how to use
- 1
Search or filter headers
Enter a header name in the search field, or filter by category (Request, Response, etc.) to find the header you need.
- 2
Review syntax and examples
Check the header description, syntax format, and practical usage examples.
- 3
Copy the header
Click the copy icon to copy the header name to your clipboard for immediate use.
Content-TypeIndicates the media type of the resource or request body
Syntax
Content-Type: <media-type>[; charset=<charset>][; boundary=<boundary>]Examples
Content-Type: application/jsonJSON request or response bodyContent-Type: text/html; charset=utf-8HTML document with UTF-8 encodingContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryFile upload form dataContent-LengthIndicates the size of the message body in bytes
Syntax
Content-Length: <length>Examples
Content-Length: 348Response body is 348 bytesContent-Length: 0Empty body (e.g., DELETE response)DateContains the date and time at which the message was originated
Syntax
Date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMTExamples
Date: Wed, 21 Oct 2015 07:28:00 GMTTimestamp of the responseConnectionControls whether the network connection stays open after the current transaction
Syntax
Connection: keep-alive | closeExamples
Connection: keep-alivePersist the connection for further requestsConnection: closeClose the connection after the responseAcceptInforms the server about the types of data the client can process
Syntax
Accept: <MIME_type>/<MIME_subtype>[;q=<weight>], ...Examples
Accept: application/jsonAccept only JSON responsesAccept: text/html, application/xhtml+xml, */*;q=0.8Prefer HTML, accept anythingAccept: image/webp, image/png, */*Prefer WebP, then PNG imagesAuthorizationContains credentials to authenticate the client with the server
Syntax
Authorization: <auth-scheme> <credentials>Examples
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...JWT Bearer token authenticationAuthorization: Basic dXNlcjpwYXNzd29yZA==HTTP Basic authentication (base64 encoded)Authorization: ApiKey my-api-key-hereCustom API key authenticationCookieContains stored HTTP cookies previously sent by the server with Set-Cookie
Syntax
Cookie: <cookie-list>Examples
Cookie: session_id=abc123Single session cookieCookie: theme=dark; lang=en; session=xyzMultiple cookies in one headerUser-AgentA characteristic string identifying the browser and operating system
Syntax
User-Agent: <product>/<version> (<system-info>) <extensions>Examples
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36Chrome on Windows 10User-Agent: curl/7.68.0curl HTTP clientRefererContains the address of the previous web page from which the current request was made
Syntax
Referer: <url>Examples
Referer: https://example.com/page1User navigated from this pageReferer: https://www.google.com/search?q=exampleUser came from a search engineHostSpecifies the host and port number of the server to which the request is being sent
Syntax
Host: <host>[:<port>]Examples
Host: example.comStandard hostname (port 80/443 implied)Host: api.example.com:8080Hostname with non-standard portSet-CookieSends cookies from the server to the client for storage
Syntax
Set-Cookie: <cookie-name>=<cookie-value>[; <attributes>]Examples
Set-Cookie: session=abc123; HttpOnly; Secure; SameSite=StrictSecure session cookieSet-Cookie: theme=dark; Max-Age=31536000; Path=/Persistent preference cookie (1 year)Set-Cookie: token=xyz; Domain=.example.com; SecureDomain-wide secure cookieLocationIndicates the URL to redirect the client to for redirection responses
Syntax
Location: <url>Examples
Location: https://example.com/new-pageAbsolute URL redirect (301/302)Location: /dashboardRelative path redirect after loginServerDescribes the software used by the origin server to handle the request
Syntax
Server: <product>Examples
Server: nginx/1.18.0nginx web server versionServer: Apache/2.4.41 (Ubuntu)Apache web server on UbuntuWWW-AuthenticateDefines the authentication method used to access a resource
Syntax
WWW-Authenticate: <type> realm=<realm>[, <params>]Examples
WWW-Authenticate: Basic realm="My Site"HTTP Basic authentication promptWWW-Authenticate: Bearer realm="api", error="invalid_token"Bearer token authentication with errorCache-ControlDirectives for caching mechanisms in both requests and responses
Syntax
Cache-Control: <directive>[, <directive>]...Examples
Cache-Control: no-cache, no-store, must-revalidateDisable all cachingCache-Control: public, max-age=31536000Cache publicly for 1 year (static assets)Cache-Control: private, max-age=600Cache privately for 10 minutesETagIdentifier for a specific version of a resource, used for cache validation
Syntax
ETag: [W/]"<etag_value>"Examples
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"Strong ETag (exact match required)ETag: W/"0815"Weak ETag (semantically equivalent)If-None-MatchMakes the request conditional on the resource not matching given ETags
Syntax
If-None-Match: [W/]"<etag_value>"[, [W/]"<etag_value>"]*Examples
If-None-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"Return 304 if ETag matches (cache hit)If-None-Match: *Succeed only if no existing resourceExpiresSpecifies the date and time after which the response is considered stale
Syntax
Expires: <http-date>Examples
Expires: Wed, 21 Oct 2025 07:28:00 GMTCache expires at this specific dateExpires: 0Resource already expired (no cache)Last-ModifiedThe date and time at which the resource was last modified on the server
Syntax
Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMTExamples
Last-Modified: Wed, 21 Oct 2015 07:28:00 GMTFile was last changed at this timeContent-Security-PolicyControls resources the browser is allowed to load for a given page
Syntax
Content-Security-Policy: <policy-directive>; ...Examples
Content-Security-Policy: default-src 'self'Allow resources only from same originContent-Security-Policy: default-src 'self'; script-src 'self' cdn.example.comAllow scripts from self and CDNContent-Security-Policy: default-src 'none'; img-src 'self' data:; style-src 'self'Strict policy allowing only self images and stylesX-Frame-OptionsIndicates whether a browser should be allowed to render a page in a frame
Syntax
X-Frame-Options: DENY | SAMEORIGINExamples
X-Frame-Options: DENYNever allow framing (clickjacking protection)X-Frame-Options: SAMEORIGINAllow framing only from the same originStrict-Transport-SecurityForces browsers to connect over HTTPS for a specified duration
Syntax
Strict-Transport-Security: max-age=<expire-time>[; includeSubDomains][; preload]Examples
Strict-Transport-Security: max-age=31536000Enforce HTTPS for 1 yearStrict-Transport-Security: max-age=63072000; includeSubDomains; preload2 years, including subdomains, HSTS preload eligibleX-Content-Type-OptionsPrevents MIME type sniffing by forcing browsers to respect the declared Content-Type
Syntax
X-Content-Type-Options: nosniffExamples
X-Content-Type-Options: nosniffDisable MIME type sniffingX-XSS-ProtectionEnables XSS filtering in older browsers (largely replaced by CSP)
Syntax
X-XSS-Protection: 0 | 1[; mode=block | report=<reporting-uri>]Examples
X-XSS-Protection: 1; mode=blockEnable XSS filter and block page if attack detectedX-XSS-Protection: 0Disable XSS filter (use with strict CSP)Permissions-PolicyControls which browser features and APIs can be used in the document
Syntax
Permissions-Policy: <feature>=(<allowlist>)[, ...]Examples
Permissions-Policy: camera=(), microphone=(), geolocation=()Disable camera, microphone, and geolocationPermissions-Policy: geolocation=(self "https://trusted.example.com")Allow geolocation from self and trusted originAccess-Control-Allow-OriginIndicates which origins are allowed to access the resource in cross-origin requests
Syntax
Access-Control-Allow-Origin: * | <origin>Examples
Access-Control-Allow-Origin: *Allow any origin (public API)Access-Control-Allow-Origin: https://example.comAllow only this specific originAccess-Control-Allow-MethodsSpecifies the HTTP methods allowed when accessing the resource in a CORS preflight response
Syntax
Access-Control-Allow-Methods: <method>[, <method>]*Examples
Access-Control-Allow-Methods: GET, POST, OPTIONSAllow GET, POST, and preflight OPTIONSAccess-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONSAllow all common REST methodsAccess-Control-Allow-HeadersIndicates which HTTP headers can be used when making the actual CORS request
Syntax
Access-Control-Allow-Headers: <header-name>[, <header-name>]*Examples
Access-Control-Allow-Headers: Content-Type, AuthorizationAllow Content-Type and Authorization headersAccess-Control-Allow-Headers: *Allow any request headersAccess-Control-Max-AgeIndicates how long the results of a preflight request can be cached
Syntax
Access-Control-Max-Age: <delta-seconds>Examples
Access-Control-Max-Age: 86400Cache preflight response for 1 dayAccess-Control-Max-Age: 3600Cache preflight response for 1 hourAbout HTTP Headers Reference
HTTP Headers Reference is a comprehensive cheat sheet covering frequently used HTTP request and response headers. Organized by category — general, request, response, caching, security, and CORS — each header includes a clear description, syntax format, and practical examples to help you implement them correctly.
Key Features
- 29 essential HTTP headers across 6 categories
- Syntax format and usage examples for each header
- Category filtering (Request, Response, Caching, Security, CORS)
- Real-time search by header name or description
- One-click copy of header names
Use Cases
- Implementing security headers (CSP, HSTS, X-Frame-Options) in an Express or Next.js app
- Setting up CORS headers to allow cross-origin requests from a React or Vue frontend
- Configuring Cache-Control headers to optimize browser caching for a CDN
- Debugging unexpected 403 or CORS errors by checking request and response headers
- Looking up the correct syntax for Authorization, Content-Type, or Accept headers in an API
- Reference during a security audit or code review of an HTTP API or web application
FAQ
What is the difference between Cache-Control and Expires?
Cache-Control is the modern standard and takes precedence when both are present. It provides fine-grained control with directives like max-age, no-cache, and no-store. Expires specifies an absolute date/time and is considered a legacy header, but is still useful for HTTP/1.0 compatibility.
What is the difference between ETag and Last-Modified?
ETag is an opaque identifier based on the content, while Last-Modified is a timestamp. ETags are more reliable because they change even if a file is regenerated with the same content at a different time. Last-Modified has 1-second precision, which can miss rapid updates.
Why should I add security headers to my site?
Security headers like Content-Security-Policy, X-Frame-Options, and Strict-Transport-Security protect against common attacks such as XSS, clickjacking, and protocol downgrade attacks. They are a critical part of defence-in-depth security and are easy to add at the server or CDN level.
What is the difference between CORS preflight and simple requests?
Simple requests (GET/POST with standard headers) are sent directly. Preflight requests (OPTIONS) are automatically sent by the browser for complex requests — those using PUT/DELETE, custom headers, or certain Content-Type values — to verify the server allows the cross-origin access before sending the actual request.
Should I use X-XSS-Protection?
X-XSS-Protection is a legacy header targeting old browsers. Modern browsers have deprecated their XSS auditors. Instead, implement a strict Content-Security-Policy header, which provides far better protection. It is generally recommended to set X-XSS-Protection: 0 when using a strong CSP.
