HTTP headers – MDN
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.
Custom proprietary headers have historically been used with an X- prefix, but this convention was deprecated in June 2012 because of the inconveniences it caused when nonstandard fields became standard in RFC 6648; others are listed in an IANA registry, whose original content was defined in RFC 4229. IANA also maintains a registry of proposed new HTTP headers.
Headers can be grouped according to their contexts:
Request headers contain more information about the resource to be fetched, or about the client requesting the resource.
Response headers hold additional information about the response, like its location or about the server providing it.
Representation headers contain information about the body of the resource, like its MIME type, or encoding/compression applied.
Payload headers contain representation-independent information about payload data, including content length and the encoding used for transport.
Headers can also be grouped according to how proxies handle them:
Connection
Keep-Alive
Proxy-Authenticate
Proxy-Authorization
TE
Trailer
Transfer-Encoding
Upgrade (see also Protocol upgrade mechanism).
End-to-end headers
These headers must be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them.
Hop-by-hop headers
These headers are meaningful only for a single transport-level connection, and must not be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the Connection header.
Authentication
WWW-Authenticate
Defines the authentication method that should be used to access a resource.
Authorization
Contains the credentials to authenticate a user-agent with a server.
Defines the authentication method that should be used to access a resource behind a proxy server.
Contains the credentials to authenticate a user agent with a proxy server.
Caching
Age
The time, in seconds, that the object has been in a proxy cache.
Cache-Control
Directives for caching mechanisms in both requests and responses.
Clear-Site-Data
Clears browsing data (e. g. cookies, storage, cache) associated with the requesting website.
Expires
The date/time after which the response is considered stale.
Pragma
Implementation-specific header that may have various effects anywhere along the request-response chain. Used for backwards compatibility with HTTP/1. 0 caches where the Cache-Control header is not yet present.
Warning
General warning information about possible problems.
Client hintsHTTP Client hints are a set of request headers that provide useful information about the client such as device type and network conditions, and allow servers to optimize what is served for those conditions.
Servers proactively requests the client hint headers they are interested in from the client using Accept-CH. The client may then choose to include the requested headers in subsequent requests.
Accept-CH
Servers can advertise support for Client Hints using the Accept-CH header field or an equivalent HTML element with -equiv attribute.
Accept-CH-Lifetime
Servers can ask the client to remember the set of Client Hints that the server supports for a specified period of time, to enable delivery of Client Hints on subsequent requests to the server’s origin.
The different categories of client hints are listed client hints
Content-DPR
Response header used to confirm the image device to pixel ratio in requests where the DPR client hint was used to select an image resource.
Device-Memory
Approximate amount of available client RAM memory. This is part of the Device Memory API.
DPR
Client device pixel ratio (DPR), which is the number of physical device pixels corresponding to every CSS pixel.
Viewport-Width
A number that indicates the layout viewport width in CSS pixels. The provided pixel value is a number rounded to the smallest following integer (i. e. ceiling value).
Width
The Width request header field is a number that indicates the desired resource width in physical pixels (i. intrinsic size of an image).
Network client hintsNetwork client hints allow a server to choose what information is sent based on the user choice and network bandwidth and latency.
Downlink
Approximate bandwidth of the client’s connection to the server, in Mbps. This is part of the Network Information API.
ECT
The effective connection type (“network profile”) that best matches the connection’s latency and bandwidth. This is part of the Network Information API.
RTT
Application layer round trip time (RTT) in miliseconds, which includes the server processing time. This is part of the Network Information API.
Save-Data
A boolean that indicates the user agent’s preference for reduced data usage.
Conditionals
Last-Modified
The last modification date of the resource, used to compare several versions of the same resource. It is less accurate than ETag, but easier to calculate in some environments. Conditional requests using If-Modified-Since and If-Unmodified-Since use this value to change the behavior of the request.
ETag
A unique string identifying the version of the resource. Conditional requests using If-Match and If-None-Match use this value to change the behavior of the request.
If-Match
Makes the request conditional, and applies the method only if the stored resource matches one of the given ETags.
If-None-Match
Makes the request conditional, and applies the method only if the stored resource doesn’t match any of the given ETags. This is used to update caches (for safe requests), or to prevent uploading a new resource when one already exists.
If-Modified-Since
Makes the request conditional, and expects the resource to be transmitted only if it has been modified after the given date. This is used to transmit data only when the cache is out of date.
If-Unmodified-Since
Makes the request conditional, and expects the resource to be transmitted only if it has not been modified after the given date. This ensures the coherence of a new fragment of a specific range with previous ones, or to implement an optimistic concurrency control system when modifying existing documents.
Vary
Determines how to match request headers to decide whether a cached response can be used rather than requesting a fresh one from the origin server.
Connection management
Controls whether the network connection stays open after the current transaction finishes.
Controls how long a persistent connection should stay open.
Content negotiationContent negotiation headers.
Accept
Informs the server about the types of data that can be sent back.
Accept-Encoding
The encoding algorithm, usually a compression algorithm, that can be used on the resource sent back.
Accept-Language
Informs the server about the human language the server is expected to send back. This is a hint and is not necessarily under the full control of the user: the server should always pay attention not to override an explicit user choice (like selecting a language from a dropdown).
Controls
Expect
Indicates expectations that need to be fulfilled by the server to properly handle the request.
Max-Forwards
TBD
CookiesCORSDownloads
Content-Disposition
Indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “Save As” dialog.
Message body information
Content-Length
The size of the resource, in decimal number of bytes.
Content-Type
Indicates the media type of the resource.
Content-Encoding
Used to specify the compression algorithm.
Content-Language
Describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the users’ own preferred language.
Content-Location
Indicates an alternate location for the returned data.
Proxies
Forwarded
Contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.
X-Forwarded-For
Identifies the originating IP addresses of a client connecting to a web server through an HTTP proxy or a load balancer.
X-Forwarded-Host
Identifies the original host requested that a client used to connect to your proxy or load balancer.
X-Forwarded-Proto
Identifies the protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer.
Via
Added by proxies, both forward and reverse proxies, and can appear in the request headers and the response headers.
Redirects
Location
Indicates the URL to redirect a page to.
Request context
From
Contains an Internet email address for a human user who controls the requesting user agent.
Host
Specifies the domain name of the server (for virtual hosting), and (optionally) the TCP port number on which the server is listening.
Referer
The address of the previous web page from which a link to the currently requested page was followed.
Referrer-Policy
Governs which referrer information sent in the Referer header should be included with requests made.
User-Agent
Contains a characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. See also the Firefox user agent string reference.
Response context
Allow
Lists the set of HTTP request methods supported by a resource.
Server
Contains information about the software used by the origin server to handle the request.
Range requests
Accept-Ranges
Indicates if the server supports range requests, and if so in which unit the range can be expressed.
Range
Indicates the part of a document that the server should return.
If-Range
Creates a conditional range request that is only fulfilled if the given etag or date matches the remote resource. Used to prevent downloading two ranges from incompatible version of the resource.
Content-Range
Indicates where in a full body message a partial message belongs.
Security
Cross-Origin-Embedder-Policy (COEP)
Allows a server to declare an embedder policy for a given document.
Cross-Origin-Opener-Policy (COOP)
Prevents other domains from opening/controlling a window.
Cross-Origin-Resource-Policy (CORP)
Prevents other domains from reading the response of the resources to which this header is applied.
Content-Security-Policy (CSP)
Controls resources the user agent is allowed to load for a given page.
Content-Security-Policy-Report-Only
Allows web developers to experiment with policies by monitoring, but not enforcing, their effects. These violation reports consist of JSON documents sent via an HTTP POST request to the specified URI.
Expect-CT
Allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements, which prevents the use of misissued certificates for that site from going unnoticed. When a site enables the Expect-CT header, they are requesting that Chrome check that any certificate for that site appears in public CT logs.
Feature-Policy
Provides a mechanism to allow and deny the use of browser features in its own frame, and in iframes that it embeds.
Origin-Isolation
Provides a mechanism to allow web applications to isolate their origins.
Strict-Transport-Security (HSTS)
Force communication using HTTPS instead of HTTP.
Upgrade-Insecure-Requests
Sends a signal to the server expressing the client’s preference for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests directive.
X-Content-Type-Options
Disables MIME sniffing and forces browser to use the type given in Content-Type.
X-Download-Options
The X-Download-Options HTTP header indicates that the browser (Internet Explorer) should not display the option to “Open” a file that has been downloaded from an application, to prevent phishing attacks as the file otherwise would gain access to execute in the context of the application. (Note: related MS Edge bug).
X-Frame-Options (XFO)
Indicates whether a browser should be allowed to render a page in a ,
List of HTTP header fields – Wikipedia
HTTP header fields are a list of linefeed-separated HTTP data being sent and received by both the client program and server on every HTTP request. These headers are usually invisible to the end-user and are only visible to the backend programs and people maintaining the internet system. They define how information sent/received through the connection are encoded (as in Accept-Encoding), the session verification and identification of the client (as in browser cookies, IP address, user-agent) or their anonymity thereof (VPN or proxy masking, user-agent spoofing), how the server should handle data (as in Do-Not-Track), the age of the document being downloaded, amongst others.
General format[edit]
The header fields are transmitted after the request line (in case of a request HTTP message) or the response line (in case of a response HTTP message), which is the first line of a message. Header fields are colon-separated key-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence. The end of the header section is indicated by an empty field line, resulting in the transmission of two consecutive CR-LF pairs. In the past, long lines could be folded into multiple lines; continuation lines are indicated by the presence of a space (SP) or horizontal tab (HT) as the first character on the next line. This folding is now deprecated. [1]
Field names[edit]
A core set of fields is standardized by the Internet Engineering Task Force (IETF) in RFCs 7230, 7231, 7232, 7233, 7234, and 7235. The permanent registry of header fields and repository of provisional registrations are maintained by the IANA. Additional field names and permissible values may be defined by each application.
Header field names are case-insensitive. [2] This is in contrast to HTTP method names (GET, POST, etc. ), which are case-sensitive. [3][4]
HTTP/2 makes some restrictions on specific header fields (see below).
Non-standard header fields were conventionally marked by prefixing the field name with X- but this convention was deprecated in June 2012 because of the inconveniences it caused when non-standard fields became standard. [5] An earlier restriction on use of Downgraded- was lifted in March 2013. [6]
Field values[edit]
A few fields can contain comments (i. e. in User-Agent, Server, Via fields), which can be ignored by software. [7]
Many field values may contain a quality (q) key-value pair separated by equals sign, specifying a weight to use in content negotiation. [8] For example, a browser may indicate that it accepts information in German or English, with German as preferred by setting the q value for de higher than that of en, as follows:
Accept-Language: de; q=1. 0, en; q=0. 5
Size limits[edit]
The standard imposes no limits to the size of each header field name or value, or to the number of fields. However, most servers, clients, and proxy software impose some limits for practical and security reasons. For example, the Apache 2. 3 server by default limits the size of each field to 8, 190 bytes, and there can be at most 100 header fields in a single request. [9]
Request fields[edit]
Standard request fields[edit]
Name
Description
Example
Status
Standard
A-IM
Acceptable instance-manipulations for the request. [10]
A-IM: feed
Permanent
RFC 3229
Accept
Media type(s) that is/are acceptable for the response. See Content negotiation.
Accept: text/html
RFC 2616, 7231
Accept-Charset
Character sets that are acceptable.
Accept-Charset: utf-8
RFC 2616
Accept-Datetime
Acceptable version in time.
Accept-Datetime: Thu, 31 May 2007 20:35:00 GMT
Provisional
RFC 7089
Accept-Encoding
List of acceptable encodings. See HTTP compression.
Accept-Encoding: gzip, deflate
Accept-Language
List of acceptable human languages for response. See Content negotiation.
Accept-Language: en-US
Access-Control-Request-Method, Access-Control-Request-Headers[11]
Initiates a request for cross-origin resource sharing with Origin (below).
Access-Control-Request-Method: GET
Permanent: standard
Authorization
Authentication credentials for HTTP authentication.
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Cache-Control
Used to specify directives that must be obeyed by all caching mechanisms along the request-response chain.
Cache-Control: no-cache
Connection
Control options for the current connection and list of hop-by-hop request fields. [12]
Must not be used with HTTP/2. [13]
Connection: keep-alive
Connection: Upgrade
Content-Encoding
The type of encoding used on the data. See HTTP compression.
Content-Encoding: gzip
Content-Length
The length of the request body in octets (8-bit bytes).
Content-Length: 348
Content-MD5
A Base64-encoded binary MD5 sum of the content of the request body.
Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ==
Obsolete[14]
Content-Type
The Media type of the body of the request (used with POST and PUT requests).
Content-Type: application/x-www-form-urlencoded
Cookie
An HTTP cookie previously sent by the server with Set-Cookie (below).
Cookie: $Version=1; Skin=new;
Date
The date and time at which the message was originated (in “HTTP-date” format as defined by RFC 7231 Date/Time Formats).
Date: Tue, 15 Nov 1994 08:12:31 GMT
Expect
Indicates that particular server behaviors are required by the client.
Expect: 100-continue
Forwarded
Disclose original information of a client connecting to a web server through an HTTP proxy. [15]
Forwarded: for=192. 0. 2. 60;proto=;by=203. 113. 43 Forwarded: for=192. 43, for=198. 51. 100. 17
From
The email address of the user making the request.
From:
Host
The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening. The port number may be omitted if the port is the standard port for the service requested.
Mandatory since HTTP/1. 1. [16]
If the request is generated directly in HTTP/2, it should not be used.
Host:
HTTP2-Settings
A request that upgrades from HTTP/1. 1 to HTTP/2 MUST include exactly one HTTP2-Setting header field. The HTTP2-Settings header field is a connection-specific header field that includes parameters that govern the HTTP/2 connection, provided in anticipation of the server accepting the request to upgrade. [18][19]
HTTP2-Settings: token64
If-Match
Only perform the action if the client supplied entity matches the same entity on the server. This is mainly for methods like PUT to only update a resource if it has not been modified since the user last updated it.
If-Match: “737060cd8c284d8af7ad3082f209582d”
If-Modified-Since
Allows a 304 Not Modified to be returned if content is unchanged.
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
If-None-Match
Allows a 304 Not Modified to be returned if content is unchanged, see HTTP ETag.
If-None-Match: “737060cd8c284d8af7ad3082f209582d”
If-Range
If the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity.
If-Range: “737060cd8c284d8af7ad3082f209582d”
If-Unmodified-Since
Only send the response if the entity has not been modified since a specific time.
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
Max-Forwards
Limit the number of times the message can be forwarded through proxies or gateways.
Max-Forwards: 10
Origin[11]
Initiates a request for cross-origin resource sharing (asks server for Access-Control-* response fields).
Origin: Permanent: standard
Pragma
Implementation-specific fields that may have various effects anywhere along the request-response chain.
Pragma: no-cache
Prefer
Allows client to request that certain behaviors be employed by a server while processing a request.
Prefer: return=representation
RFC 7240
Proxy-Authorization
Authorization credentials for connecting to a proxy.
Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Range
Request only part of an entity. Bytes are numbered from 0. See Byte serving.
Range: bytes=500-999
Referer [sic]
This is the address of the previous web page from which a link to the currently requested page was followed. (The word “referrer” has been misspelled in the RFC as well as in most implementations to the point that it has become standard usage and is considered correct terminology)
Referer: Permanent
TE
The transfer encodings the user agent is willing to accept: the same values as for the response header field Transfer-Encoding can be used, plus the “trailers” value (related to the “chunked” transfer method) to notify the server it expects to receive additional fields in the trailer after the last, zero-sized, chunk.
Only trailers is supported in HTTP/2. [13]
TE: trailers, deflate
Trailer
The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer coding.
Trailer: Max-Forwards
Transfer-Encoding
The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity.
Transfer-Encoding: chunked
User-Agent
The user agent string of the user agent.
User-Agent: Mozilla/5. 0 (X11; Linux x86_64; rv:12. 0) Gecko/20100101 Firefox/12. 0
Upgrade
Ask the server to upgrade to another protocol.
Must not be used in HTTP/2. [13]
Upgrade: h2c, HTTPS/1. 3, IRC/6. 9, RTA/x11, websocket
Via
Informs the server of proxies through which the request was sent.
Via: 1. 0 fred, 1. 1 (Apache/1. 1)
Warning
A general warning about possible problems with the entity body.
Warning: 199 Miscellaneous warning
Common non-standard request fields[edit]
Field name
Upgrade-Insecure-Requests[20]
Tells a server which (presumably in the middle of a HTTP -> HTTPS migration) hosts mixed content that the client would prefer redirection to HTTPS and can handle Content-Security-Policy: upgrade-insecure-requests
Must not be used with HTTP/2[13]
Upgrade-Insecure-Requests: 1
X-Requested-With
Mainly used to identify Ajax requests (most JavaScript frameworks send this field with value of XMLHttpRequest); also identifies Android apps using WebView[21]
X-Requested-With: XMLHttpRequest
DNT[22]
Requests a web application to disable their tracking of a user. This is Mozilla’s version of the X-Do-Not-Track header field (since Firefox 4. 0 Beta 11). Safari and IE9 also have support for this field. [23] On March 7, 2011, a draft proposal was submitted to IETF. [24] The W3C Tracking Protection Working Group is producing a specification. [25]
DNT: 1 (Do Not Track Enabled)
DNT: 0 (Do Not Track Disabled)
X-Forwarded-For[26]
A de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer. Superseded by Forwarded header.
X-Forwarded-For: client1, proxy1, proxy2
X-Forwarded-For: 129. 78. 138. 66, 129. 64. 103
X-Forwarded-Host[27]
A de facto standard for identifying the original host requested by the client in the Host HTTP request header, since the host name and/or port of the reverse proxy (load balancer) may differ from the origin server handling the request. Superseded by Forwarded header.
X-Forwarded-Host:
X-Forwarded-Proto[28]
A de facto standard for identifying the originating protocol of an HTTP request, since a reverse proxy (or a load balancer) may communicate with a web server using HTTP even if the request to the reverse proxy is HTTPS. An alternative form of the header (X-ProxyUser-Ip) is used by Google clients talking to Google servers. Superseded by Forwarded header.
X-Forwarded-Proto:
Front-End-Https[29]
Non-standard header field used by Microsoft applications and load-balancers
Front-End-Https: on
X-Http-Method-Override[30]
Requests a web application to override the method specified in the request (typically POST) with the method given in the header field (typically PUT or DELETE). This can be used when a user agent or firewall prevents PUT or DELETE methods from being sent directly (note that this is either a bug in the software component, which ought to be fixed, or an intentional configuration, in which case bypassing it may be the wrong thing to do).
X-HTTP-Method-Override: DELETE
X-ATT-DeviceId[31]
Allows easier parsing of the MakeModel/Firmware that is usually found in the User-Agent String of AT&T Devices
X-Att-Deviceid: GT-P7320/P7320XXLPG
X-Wap-Profile[32]
Links to an XML file on the Internet with a full description and details about the device currently connecting. In the example to the right is an XML file for an AT&T Samsung Galaxy S2.
x-wap-profile:
Proxy-Connection[33]
Implemented as a misunderstanding of the HTTP specifications. Common because of mistakes in implementations of early HTTP versions. Has exactly the same functionality as standard Connection field.
Proxy-Connection: keep-alive
X-UIDH[34][35][36]
Server-side deep packet insertion of a unique ID identifying customers of Verizon Wireless; also known as “perma-cookie” or “supercookie”
X-UIDH:…
X-Csrf-Token[37]
Used to prevent cross-site request forgery. Alternative header names are: X-CSRFToken[38] and X-XSRF-TOKEN[39]
X-Csrf-Token: i8XNjC4b8KVok4uw5RftR38Wgp2BFwql
X-Request-ID, [40][41]
X-Correlation-ID[42][43]
Correlates HTTP requests between a client and server.
X-Request-ID: f058ebd6-02f7-4d3f-942e-904344e8cde5
Save-Data[44]
The Save-Data client hint request header available in Chrome, Opera, and Yandex browsers lets developers deliver lighter, faster applications to users who opt-in to data saving mode in their browser.
Save-Data: on
Response fields[edit]
Standard response fields[edit]
Accept-CH
Requests HTTP Client Hints
Accept-CH: UA, Platform
Experimental
RFC 8942
Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Expose-Headers, Access-Control-Max-Age, Access-Control-Allow-Methods, Access-Control-Allow-Headers[11]
Specifying which web sites can participate in cross-origin resource sharing
Access-Control-Allow-Origin: *
Accept-Patch[45]
Specifies which patch document formats this server supports
Accept-Patch: text/example;charset=utf-8
Accept-Ranges
What partial content range types this server supports via byte serving
Accept-Ranges: bytes
Age
The age the object has been in a proxy cache in seconds
Age: 12
Allow
Valid methods for a specified resource. To be used for a 405 Method not allowed
Allow: GET, HEAD
Alt-Svc[46]
A server uses “Alt-Svc” header (meaning Alternative Services) to indicate that its resources can also be accessed at a different network location (host or port) or using a different protocol
When using HTTP/2, servers should instead send an ALTSVC frame. [47]
Alt-Svc: /1. 1=””; ma=7200
Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds
Cache-Control: max-age=3600
Control options for the current connection and list of hop-by-hop response fields. [12]
Connection: close
Content-Disposition[48]
An opportunity to raise a “File Download” dialogue box for a known MIME type with binary format or suggest a filename for dynamic content. Quotes are necessary with special characters.
Content-Disposition: attachment; filename=””
Content-Language
The natural language or languages of the intended audience for the enclosed content[49]
Content-Language: da
The length of the response body in octets (8-bit bytes)
Content-Location
An alternate location for the returned data
Content-Location: /
A Base64-encoded binary MD5 sum of the content of the response
Content-Range
Where in a full body message this partial message belongs
Content-Range: bytes 21010-47021/47022
The MIME type of this content
Content-Type: text/html; charset=utf-8
The date and time that the message was sent (in “HTTP-date” format as defined by RFC 7231) [50]
Delta-Base
Specifies the delta-encoding entity tag of the response. [10]
Delta-Base: “abc”
ETag
An identifier for a specific version of a resource, often a message digest
ETag: “737060cd8c284d8af7ad3082f209582d”
Expires
Gives the date/time after which the response is considered stale (in “HTTP-date” format as defined by RFC 7231)
Expires: Thu, 01 Dec 1994 16:00:00 GMT
IM
Instance-manipulations applied to the response. [10]
IM: feed
Last-Modified
The last modified date for the requested object (in “HTTP-date” format as defined by RFC 7231)
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
Link
Used to express a typed relationship with another resource, where the relation type is defined by RFC 5988
Link: ; rel=”alternate”[51]
Location
Used in redirection, or when a new resource has been created.
Example 1: Location: Example 2: Location: /pub/WWW/
P3P
This field is supposed to set P3P policy, in the form of P3P_CP=”your_compact_policy”. However, P3P did not take off, [52] most browsers have never fully implemented it, a lot of websites set this field with fake policy text, that was enough to fool browsers the existence of P3P policy and grant permissions for third party cookies.
P3P: CP=”This is not a P3P policy! See for more info. ”
Preference-Applied
Indicates which Prefer tokens were honored by the server and applied to the processing of the request.
Preference-Applied: return=representation
Proxy-Authenticate
Request authentication to access the proxy.
Proxy-Authenticate: Basic
Public-Key-Pins[53]
HTTP Public Key Pinning, announces hash of website’s authentic TLS certificate
Public-Key-Pins: max-age=2592000; pin-sha256=”E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=”;
Retry-After
If an entity is temporarily unavailable, this instructs the client to try again later. Value could be a specified period of time (in seconds) or a HTTP-date. [54]
Example 1: Retry-After: 120
Example 2: Retry-After: Fri, 07 Nov 2014 23:59:59 GMT
Server
A name for the server
Server: Apache/2. 4. 1 (Unix)
Set-Cookie
An HTTP cookie
Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1
Strict-Transport-Security
A HSTS Policy informing the HTTP client how long to cache the HTTPS only policy and whether this applies to subdomains.
Strict-Transport-Security: max-age=16070400; includeSubDomains
Tk
Tracking Status header, value suggested to be sent in response to a DNT(do-not-track), possible values:
“! ” — under construction
“? ” — dynamic
“G” — gateway to multiple parties
“N” — not tracking
“T” — tracking
“C” — tracking with consent
“P” — tracking only if consented
“D” — disregarding DNT
“U” — updated
Tk:?
Ask the client to upgrade to another protocol.
Must not be used in HTTP/2[13]
Vary
Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server.
Example 1: Vary: *
Example 2: Vary: Accept-Language
Informs the client of proxies through which the response was sent.
WWW-Authenticate
Indicates the authentication scheme that should be used to access the requested entity.
WWW-Authenticate: Basic
X-Frame-Options[55]
Clickjacking protection: deny – no rendering within a frame, sameorigin – no rendering if origin mismatch, allow-from – allow from specified location, allowall – non-standard, allow from any location
X-Frame-Options: deny
Obsolete[56]
Common non-standard response fields[edit]
Content-Security-Policy, X-Content-Security-Policy, X-WebKit-CSP[57]
Content Security Policy definition.
X-WebKit-CSP: default-src ‘self’
Expect-CT[58]
Notify to prefer to enforce Certificate Transparency.
Expect-CT: max-age=604800, enforce, report-uri=”
NEL[59]
Used to configure network request logging.
NEL: { “report_to”: “name_of_reporting_group”, “max_age”: 12345, “include_subdomains”: false, “success_fraction”: 0. 0, “failure_fraction”: 1. 0}
Permissions-Policy[60]
To allow or disable different features or APIs of the browser.
Permissions-Policy: fullscreen=(), camera=(), microphone=(), geolocation=(), interest-cohort=()[61]
Refresh
Used in redirection, or when a new resource has been created. This refresh redirects after 5 seconds. Header extension introduced by Netscape and supported by most web browsers. Defined by HTML Standard[62]
Refresh: 5; url=
Report-To[63]
Instructs the user agent to store reporting endpoints for an origin.
Report-To: { “group”: “csp-endpoint”, “max_age”: 10886400, “endpoints”: [ { “url”: “-url-of-site-which-collects-reports”}]}
CGI header field specifying the status of the HTTP response. Normal HTTP responses use a separate “Status-Line” instead, defined by RFC 7230. [64]
Status: 200 OK
Timing-Allow-Origin
The Timing-Allow-Origin response header specifies origins that are allowed to see values of attributes retrieved via features of the Resource Timing API, which would otherwise be reported as zero due to cross-origin restrictions. [65]
Timing-Allow-Origin: *
Timing-Allow-Origin:
X-Content-Duration[66]
Provide the duration of the audio or video in seconds; only supported by Gecko browsers
X-Content-Duration: 42. 666
X-Content-Type-Options[67]
The only defined value, “nosniff”, prevents Internet Explorer from MIME-sniffing a response away from the declared content-type. This also applies to Google Chrome, when downloading extensions. [68]
X-Content-Type-Options: nosniff[69]
X-Powered-By[70]
Specifies the technology (e. g., PHP, JBoss) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version)
X-Powered-By: PHP/5. 0
X-Redirect-By[71]
Specifies the component that is responsible for a particular redirect.
X-Redirect-By: WordPressX-Redirect-By: Polylang
X-Request-ID, X-Correlation-ID[40]
X-UA-Compatible[72]
Recommends the preferred rendering engine (often a backward-compatibility mode) to use to display the content. Also used to activate Chrome Frame in Internet Explorer. In HTML Standard, only the IE=edge value is defined. [73]
X-UA-Compatible: IE=edgeX-UA-Compatible: IE=EmulateIE7X-UA-Compatible: Chrome=1
X-XSS-Protection[74]
Cross-site scripting (XSS) filter
X-XSS-Protection: 1; mode=block
Effects of selected fields[edit]
Avoiding caching[edit]
If a web server responds with Cache-Control: no-cache then a web browser or other caching system (intermediate proxies) must not use the response to satisfy subsequent requests without first checking with the originating server (this process is called validation). This header field is part of HTTP version 1. 1, and is ignored by some caches and browsers. It may be simulated by setting the Expires HTTP version 1. 0 header field value to a time earlier than the response time. Notice that no-cache is not instructing the browser or proxies about whether or not to cache the content. It just tells the browser and proxies to validate the cache content with the server before using it (this is done by using If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match attributes mentioned above). Sending a no-cache value thus instructs a browser or proxy to not use the cache contents merely based on “freshness criteria” of the cache content. Another common way to prevent old content from being shown to the user without validation is Cache-Control: max-age=0. This instructs the user agent that the content is stale and should be validated before use.
The header field Cache-Control: no-store is intended to instruct a browser application to make a best effort not to write it to disk (i. e not to cache it).
The request that a resource should not be cached is no guarantee that it will not be written to disk. In particular, the HTTP/1. 1 definition draws a distinction between history stores and caches. If the user navigates back to a previous page a browser may still show you a page that has been stored on disk in the history store. This is correct behavior according to the specification. Many user agents show different behavior in loading pages from the history store or cache depending on whether the protocol is HTTP or HTTPS.
The Cache-Control: no-cache HTTP/1. 1 header field is also intended for use in requests made by the client. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh version of the resource. The Pragma: no-cache header field, defined in the HTTP/1. 0 spec, has the same purpose. It, however, is only defined for the request header. Its meaning in a response header is not specified. [75] The behavior of Pragma: no-cache in a response is implementation specific. While some user agents do pay attention to this field in responses, [76] the HTTP/1. 1 RFC specifically warns against relying on this behavior.
See also[edit]
HTTP header injection
HTTP ETag
List of HTTP status codes
References[edit]
^ “Hypertext Transfer Protocol (HTTP/1. 1): Message Syntax and Routing”. Retrieved July 23, 2014.
^ RFC-7230 section 3. 2
^ RFC-7210 section 3. 1
^ RFC-7231 section 4. 1
^ Internet Engineering Task Force (June 1, 2012). “RFC 6648”. Retrieved November 12, 2012.
^ “Message Headers”. June 11, 2014. Retrieved June 12, 2014.
^ “Hypertext Transfer Protocol (HTTP/1. Retrieved July 24, 2014.
^ “Hypertext Transfer Protocol (HTTP/1. 1): Semantics and Content”. Retrieved July 24, 2014.
^ “core – Apache HTTP Server”. Archived from the original on May 9, 2012. Retrieved March 13, 2012.
^ a b c RFC 3229. doi:10. 17487/RFC3229.
^ a b c “Cross-Origin Resource Sharing”. Retrieved July 24, 2017.
^ a b “Hypertext Transfer Protocol (HTTP/1. IETF. June 2014. Retrieved December 19, 2014.
^ a b c d e f g h i “Hypertext Transfer Protocol Version 2 (HTTP/2)”. May 2015. Retrieved June 6, 2017.
^ a b “Hypertext Transfer Protocol (HTTP/1. Retrieved June 3, 2015.
^ “Forwarded HTTP Extension: Introduction”. Retrieved January 7, 2016.
^ “Hypertext Transfer Protocol (HTTP/1. Retrieved July 24, 2014.
^ “Message Headers”.. Retrieved November 26, 2018.
^ “Hypertext Transfer Protocol Version 2 (HTTP/2)”. May 30, 2015. Retrieved February 22, 2019.
^ “Upgrade Insecure Requests – W3C Candidate Recommendation”. W3C. October 8, 2015. Retrieved January 14, 2016.
^
^ “Try out the “Do Not Track” HTTP header”. Retrieved January 31, 2011.
^ “Web Tracking Protection: Minimum Standards and Opportunities to Innovate”. Retrieved March 24, 2011.
^ IETF Do Not Track: A Universal Third-Party Web Tracking Opt Out March 7, 2011
^ W3C Tracking Preference Expression (DNT), January 26, 2012
^ Amos Jeffries (July 2, 2010). “SquidFaq/ConfiguringSquid – Squid Web Proxy Wiki”. Retrieved September 10, 2009.
^ The Apache Software Foundation. “mod_proxy – Apache HTTP Server Version 2. 2”. Retrieved November 12, 2014.
^ Dave Steinberg (April 10, 2007). “How do I adjust my SSL site to work with GeekISP’s loadbalancer? “. Retrieved September 30, 2010.
^ “Helping to Secure Communication: Client to Front-End Server”. July 27, 2006. Retrieved April 23, 2012.
^ “OpenSocial Core API Server Specification 2. 5. 1”. Retrieved October 8, 2014.
^ “ATT Device ID”. Archived from the original on February 16, 2012. Retrieved January 14, 2012.
^ “WAP Profile”. Retrieved January 14, 2012.
^ de Boyne Pollard, Jonathan (2007). “The Proxy-Connection: header is a mistake in how some web browsers use HTTP”. Retrieved January 16, 2018.
^ “Verizon Injecting Perma-Cookies to Track Mobile Customers, Bypassing Privacy Controls”. Electronic Frontier Foundation. Retrieved January 19, 2014.
^ “Checking known AT&T, Verizon, Sprint, Bell Canada & Vodacom Unique Identifier beacons”. Retrieved January 19, 2014.
^ Craig Timberg. “Verizon, AT&T tracking their users with ‘supercookies'”. The Washington Post. Retrieved January 19, 2014.
^ “SAP Cross-Site Request Forgery Protection”. SAP SE. Retrieved January 20, 2015.
^ “Django Cross Site Request Forgery protection”. Django (web framework). Archived from the original on January 20, 2015. Retrieved January 20, 2015.
^ “Angular Cross Site Request Forgery (XSRF) Protection”. AngularJS. Retrieved January 20, 2015.
^ a b “What is the X-REQUEST-ID header? “. Retrieved May 19, 2016.
^ “HTTP Request IDs”. Retrieved February 6, 2018.
^ “The Value of Correlation IDs”. Rapid7 Blog. December 23, 2016. Retrieved April 13, 2018.
^ Hilton, Peter. “Correlation IDs for microservices architectures – Peter Hilton”. Retrieved April 13, 2018.
^ “Save Data API Living Document Draft Community Group Report 2. Save-Data Request Header Field”. Web Platform Incubator Community Group. June 30, 2020. Retrieved March 5, 2021.
^ “RFC 5789”. Retrieved December 24, 2014.
^ “HTTP Alternative Services”. April 2016. Retrieved April 19, 2016.
^ “HTTP Alternative Services, section 3”. Retrieved June 8, 2017.
^ “RFC 6266”. Retrieved March 13, 2015.
^ “RFC 7231 – Hypertext Transfer Protocol (HTTP/1. Retrieved December 11, 2017.
^ “RFC7231 Compliant HTTP Date Headers”.
^ Indicate the canonical version of a URL by responding with the Link rel=”canonical” HTTP header Retrieved: 2012-02-09
^ W3C P3P Work Suspended
^ “Public Key Pinning Extension for HTTP”. Retrieved April 17, 2015.
^ “HTTP Header Field X-Frame-Options”. 2013. Retrieved June 12, 2014.
^ “Content Security Policy Level 2”. Retrieved August 2, 2014.
^ “Content Security Policy”. 2012. Retrieved April 28, 2017.
^ “Expect-CT”. Mozilla Developer Network. Retrieved July 23, 2021.
^ “NEL”. 2021. Retrieved May 18, 2021.
^ “Permissions Policy”. 2020. Retrieved May 1, 2021.
^ “Am I FLoCed? “. EFF. Retrieved May 1, 2021.
^ “Define the HTTP Refresh header by annevk · Pull Request #2892 · whatwg/html”. GitHub. August 9, 2017. Retrieved April 17, 2021.
^ “CSP: report-to”. Retrieved May 18, 2021.
^ “Timing-Allow-Origin”. Retrieved January 25, 2018.
^ “Configuring servers for Ogg media”. May 26, 2014. Retrieved January 3, 2015.
^ Eric Lawrence (September 3, 2008). “IE8 Security Part VI: Beta 2 Update”. Retrieved September 28, 2010.
^ “Hosting – Google Chrome Extensions – Google Code”. Retrieved June 14, 2012.
^ van Kesteren, Anne (August 26, 2016). “Fetch standard”. WHATWG. Archived from the original on August 26, 2016. Retrieved August 26, 2016.
^ “Why does framework add the ” HTTP Header in responses? – Stack Overflow”. Retrieved September 30, 2010.
^ “X-Redirect-By HTTP response header”. Retrieved May 29, 2021.
^ “Defining Document Compatibility: Specifying Document Compatibility Modes”. April 1, 2011. Retrieved January 24, 2012.
^ “HTML Living Standard 4. 3 Pragma directives, X-UA-Compatible state”. March 12, 2021. Retrieved March 14, 2021. For meta elements with an -equiv attribute in the X-UA-Compatible state, the content attribute must have a value that is an ASCII case-insensitive match for the string”IE=edge”.
^ Eric Lawrence (July 2, 2008). “IE8 Security Part IV: The XSS Filter”. Retrieved September 30, 2010.
^ “Hypertext Transfer Protocol (HTTP/1. 1): Caching”. Retrieved July 24, 2014.
^ “How to prevent caching in Internet Explorer”. Microsoft. September 22, 2011. Retrieved April 15, 2015.
External links[edit]
Headers: Permanent Message Header Field Names
RFC 6265: IETF HTTP State Management Mechanism
RFC 7230: Hypertext Transfer Protocol (HTTP/1. 1): Message Syntax and Routing
RFC 7231: Hypertext Transfer Protocol (HTTP/1. 1): Semantics and Content
RFC 7232: Hypertext Transfer Protocol (HTTP/1. 1): Conditional Requests
RFC 7233: Hypertext Transfer Protocol (HTTP/1. 1): Range Requests
RFC 7234: Hypertext Transfer Protocol (HTTP/1. 1): Caching
RFC 7235: Hypertext Transfer Protocol (HTTP/1. 1): Authentication
RFC 7239: Forwarded HTTP Extension
RFC 7240: Prefer Header for HTTP
HTTP/1. 1 headers from a web server point of view
Internet Explorer and Custom HTTP Headers – EricLaw’s IEInternals – Site Home – MSDN Blogs
HTTP – Header Fields – Tutorialspoint
HTTP header fields provide required information about the request or response, or about the object sent in the message body. There are four types of HTTP message headers:
General-header: These header fields have general applicability for both request and response messages.
Client Request-header: These header fields have applicability only for request messages.
Server Response-header: These header fields have applicability only for response messages.
Entity-header: These header fields define meta information about the entity-body or, if no body is present, about the resource identified by the request.
General Headers
Cache-Control
The Cache-Control general-header field is used to specify directives that MUST be obeyed by all the caching system. The syntax is as follows:
Cache-Control: cache-request-directive|cache-response-directive
An HTTP client or server can use the Cache-control general header to specify parameters for the cache or to request certain kinds of documents from the cache. The caching directives are specified in a comma-separated list. For example:
Cache-control: no-cache
The following table lists the important cache request directives that can be used by the client in its HTTP request:
S. N.
Cache Request Directive and Description
1
no-cacheA cache must not use the response to satisfy a subsequent request without successful revalidation with the origin server.
2
no-storeThe cache should not store anything about the client request or server response.
3
max-age = secondsIndicates that the client is willing to accept a response whose age is not greater than the specified time in seconds.
4
max-stale [ = seconds]Indicates that the client is willing to accept a response that has exceeded its expiration time. If seconds are given, it must not be expired by more than that time.
5
min-fresh = secondsIndicates that the client is willing to accept a response whose freshness lifetime is not less than its current age plus the specified time in seconds.
6
no-transformDoes not convert the entity-body.
7
only-if-cachedDoes not retrieve new data. The cache can send a document only if it is in the cache, and should not contact the origin-server to see if a newer copy exists.
The following important cache response directives that can be used by the server in its HTTP response:
Cache Response Directive and Description
publicIndicates that the response may be cached by any cache.
privateIndicates that all or part of the response message is intended for a single user and must not be cached by a shared cache.
no-cacheA cache must not use the response to satisfy a subsequent request without successful re-validation with the origin server.
must-revalidateThe cache must verify the status of the stale documents before using it and expired ones should not be used.
proxy-revalidateThe proxy-revalidate directive has the same meaning as the must- revalidate directive, except that it does not apply to non-shared user agent caches.
8
9
s-maxage = secondsThe maximum age specified by this directive overrides the maximum age specified by either the max-age directive or the Expires header. The s-maxage directive is always ignored by a private cache.
Connection
The Connection general-header field allows the sender to specify options that are desired for that particular connection and must not be communicated by proxies over further connections. Following is the simple syntax for using connection header:
Connection: “Connection”
HTTP/1. 1 defines the “close” connection option for the sender to signal that the connection will be closed after completion of the response. For example:
Connection: close
By default, HTTP 1. 1 uses persistent connections, where the connection does not automatically close after a transaction. HTTP 1. 0, on the other hand, does not have persistent connections by default. If a 1. 0 client wishes to use persistent connections, it uses the keep-alive parameter as follows:
Connection: keep-alive
Date
All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. HTTP applications are allowed to use any of the following three representations of date/time stamps:
Sun, 06 Nov 1994 08:49:37 GMT; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994; ANSI C’s asctime() format
Here the first format is the most preferred one.
Pragma
The Pragma general-header field is used to include implementation specific directives that might apply to any recipient along the request/response chain. For example:
Pragma: no-cache
The only directive defined in HTTP/1. 0 is the no-cache directive and is maintained in HTTP 1. 1 for backward compatibility. No new Pragma directives will be defined in the future.
Trailer
The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding. Following is the syntax of Trailer header field:
Trailer: field-name
Message header fields listed in the Trailer header field must not include the following header fields:
Transfer-Encoding
Content-Length
The Transfer-Encoding general-header field indicates what type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient. This is not the same as content-encoding because transfer-encodings are a property of the message, not of the entity-body. The syntax of Transfer-Encoding header field is as follows:
Transfer-Encoding: chunked
All transfer-coding values are case-insensitive.
Upgrade
The Upgrade general-header allows the client to specify what additional communication protocols it supports and would like to use if the server finds it appropriate to switch protocols. For example:
Upgrade: HTTP/2. 0, SHTTP/1. 3, IRC/6. 9, RTA/x11
The Upgrade header field is intended to provide a simple mechanism for transition from HTTP/1. 1 to some other, incompatible protocol.
Via
The Via general-header must be used by gateways and proxies to indicate the intermediate protocols and recipients. For example, a request message could be sent from an HTTP/1. 0 user agent to an internal proxy code-named “fred”, which uses HTTP/1. 1 to forward the request to a public proxy at, which completes the request by forwarding it to the origin server at. The request received by would then have the following Via header field:
Via: 1. 0 fred, 1. 1 (Apache/1. 1)
Warning
The Warning general-header is used to carry additional information about the status or transformation of a message which might not be reflected in the message. A response may carry more than one Warning header.
Warning: warn-code SP warn-agent SP warn-text SP warn-date
Client Request Headers
Accept
The Accept request-header field can be used to specify certain media types which are acceptable for the response. The general syntax is as follows:
Accept: type/subtype [q=qvalue]
Multiple media types can be listed separated by commas and the optional qvalue represents an acceptable quality level for accept types on a scale of 0 to 1. Following is an example:
Accept: text/plain; q=0. 5, text/html, text/x-dvi; q=0. 8, text/x-c
This would be interpreted as text/html and text/x-c and are the preferred media types, but if they do not exist, then send the text/x-dvi entity, and if that does not exist, send the text/plain entity.
Accept-Charset
The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response. Following is the general syntax:
Accept-Charset: character_set [q=qvalue]
Multiple character sets can be listed separated by commas and the optional qvalue represents an acceptable quality level for nonpreferred character sets on a scale of 0 to 1. Following is an example:
Accept-Charset: iso-8859-5, unicode-1-1; q=0. 8
The special value “*”, if present in the Accept-Charset field, matches every character set and if no Accept-Charset header is present, the default is that any character set is acceptable.
Accept-Encoding
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response. The general syntax is:
Accept-Encoding: encoding types
Examples are as follows:
Accept-Encoding: compress, gzip
Accept-Encoding:
Accept-Encoding: *
Accept-Encoding: compress;q=0. 5, gzip;q=1. 0
Accept-Encoding: gzip;q=1. 0, identity; q=0. 5, *;q=0
Accept-Language
The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that are preferred as a response to the request. The general syntax is:
Accept-Language: language [q=qvalue]
Multiple languages can be listed separated by commas and the optional qvalue represents an acceptable quality level for non preferred languages on a scale of 0 to 1. Following is an example:
Accept-Language: da, en-gb;q=0. 8, en;q=0. 7
Authorization
The Authorization request-header field value consists of credentials containing the authentication information of the user agent for the realm of the resource being requested. The general syntax is:
Authorization: credentials
The HTTP/1. 0 specification defines the BASIC authorization scheme, where the authorization parameter is the string of username:password encoded in base 64. Following is an example:
Authorization: BASIC Z3Vlc3Q6Z3Vlc3QxMjM=
The value decodes into is guest:guest123 where guest is user ID and guest123 is the password.
Cookie
The Cookie request-header field value contains a name/value pair of information stored for that URL. Following is the general syntax:
Cookie: name=value
Multiple cookies can be specified separated by semicolons as follows:
Cookie: name1=value1;name2=value2;name3=value3
Expect
The Expect request-header field is used to indicate that a particular set of server behaviors is required by the client. The general syntax is:
Expect: 100-continue | expectation-extension
If a server receives a request containing an Expect field that includes an expectation-extension that it does not support, it must respond with a 417 (Expectation Failed) status.
From
The From request-header field contains an Internet e-mail address for the human user who controls the requesting user agent. Following is a simple example:
From:
This header field may be used for logging purposes and as a means for identifying the source of invalid or unwanted requests.
Host
The Host request-header field is used to specify the Internet host and the port number of the resource being requested. The general syntax is:
Host: “Host” “:” host [ “:” port];
A host without any trailing port information implies the default port, which is 80. For example, a request on the origin server for would be:
GET /pub/WWW/ HTTP/1. 1
Host:
If-Match
The If-Match request-header field is used with a method to make it conditional. This header requests the server to perform the requested method only if the given value in this tag matches the given entity tags represented by ETag. The general syntax is:
If-Match: entity-tag
An asterisk (*) matches any entity, and the transaction continues only if the entity exists. Following are possible examples:
If-Match: “xyzzy”
If-Match: “xyzzy”, “r2d2xxxx”, “c3piozzzz”
If-Match: *
If none of the entity tags match, or if “*” is given and no current entity exists, the server must not perform the requested method, and must return a 412 (Precondition Failed) response.
If-Modified-Since
The If-Modified-Since request-header field is used with a method to make it conditional. If the requested URL has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. The general syntax of if-modified-since is:
If-Modified-Since: HTTP-date
An example of the field is:
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
If-None-Match
The If-None-Match request-header field is used with a method to make it conditional. This header requests the server to perform the requested method only if one of the given value in this tag matches the given entity tags represented by ETag. The general syntax is:
If-None-Match: entity-tag
An asterisk (*) matches any entity, and the transaction continues only if the entity does not exist. Following are the possible examples:
If-None-Match: “xyzzy”
If-None-Match: “xyzzy”, “r2d2xxxx”, “c3piozzzz”
If-None-Match: *
If-Range
The If-Range request-header field can be used with a conditional GET to request only the portion of the entity that is missing, if it has not been changed, and the entire entity if it has been changed. The general syntax is as follows:
If-Range: entity-tag | HTTP-date
Either an entity tag or a date can be used to identify the partial entity already received. For example:
If-Range: Sat, 29 Oct 1994 19:43:31 GMT
Here if the document has not been modified since the given date, the server returns the byte range given by the Range header, otherwise it returns all of the new document.
If-Unmodified-Since
The If-Unmodified-Since request-header field is used with a method to make it conditional. The general syntax is:
If-Unmodified-Since: HTTP-date
If the requested resource has not been modified since the time specified in this field, the server should perform the requested operation as if the If-Unmodified-Since header were not present. For example:
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
If the request results in anything other than a 2xx or 412 status, the If-Unmodified-Since header should be ignored.
Max-Forwards
The Max-Forwards request-header field provides a mechanism with the TRACE and OPTIONS methods to limit the number of proxies or gateways that can forward the request to the next inbound server. Here is the general syntax:
Max-Forwards: n
The Max-Forwards value is a decimal integer indicating the remaining number of times this request message may be forwarded. This is useful for debugging with the TRACE method, avoiding infinite loops. For example:
Max-Forwards: 5
The Max-Forwards header field may be ignored for all other methods defined in the HTTP specification.
Proxy-Authorization
The Proxy-Authorization request-header field allows the client to identify itself (or its user) to a proxy which requires authentication. Here is the general syntax:
Proxy-Authorization: credentials
The Proxy-Authorization field value consists of credentials containing the authentication information of the user agent for the proxy and/or realm of the resource being requested.
Range
The Range request-header field specifies the partial range(s) of the content requested from the document. The general syntax is:
Range: bytes-unit=first-byte-pos “-” [last-byte-pos]
The first-byte-pos value in a byte-range-spec gives the byte-offset of the first byte in a range. The last-byte-pos value gives the byte-offset of the last byte in the range; that is, the byte positions specified are inclusive. You can specify a byte-unit as bytes. Byte offsets start at zero. Some simple examples are as follows:
– The first 500 bytes
Range: bytes=0-499
– The second 500 bytes
Range: bytes=500-999
– The final 500 bytes
Range: bytes=-500
– The first and last bytes only
Range: bytes=0-0, -1
Multiple ranges can be listed, separated by commas. If the first digit in the comma-separated byte range(s) is missing, the range is assumed to count from the end of the document. If the second digit is missing, the range is byte n to the end of the document.
Referer
The Referer request-header field allows the client to specify the address (URI) of the resource from which the URL has been requested. The general syntax is as follows:
Referer: absoluteURI | relativeURI
Following is a simple example:
Referer:
If the field value is a relative URI, it should be interpreted relative to the Request-URI.
TE
The TE request-header field indicates what extension transfer-coding it is willing to accept in the response and whether or not it is willing to accept trailer fields in a chunked transfer-coding. Following is the general syntax:
TE: t-codings
The presence of the keyword “trailers” indicates that the client is willing to accept trailer fields in a chunked transfer-coding and it is specified either of the ways:
TE: deflate
TE:
TE: trailers, deflate;q=0. 5
If the TE field-value is empty or if no TE field is present, then only transfer-coding is chunked. A message with no transfer-coding is always acceptable.
User-Agent
The User-Agent request-header field contains information about the user agent originating the request. Following is the general syntax:
User-Agent: product | comment
Example:
User-Agent: Mozilla/4. 0 (compatible; MSIE5. 01; Windows NT)
Server Response Headers
Accept-Ranges
The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a resource. The general syntax is:
Accept-Ranges: range-unit | none
For example a server that accepts byte-range requests may send:
Accept-Ranges: bytes
Servers that do not accept any kind of range request for a resource may send:
Accept-Ranges: none
This will advise the client not to attempt a range request.
Age
The Age response-header field conveys the sender’s estimate of the amount of time since the response (or its revalidation) was generated at the origin server. The general syntax is:
Age: delta-seconds
Age values are non-negative decimal integers, representing time in seconds. Following is a simple example:
Age: 1030
An HTTP/1. 1 server that includes a cache must include an Age header field in every response generated from its own cache.
ETag
The ETag response-header field provides the current value of the entity tag for the requested variant. The general syntax is:
ETag: entity-tag
Here are some simple examples:
ETag: “xyzzy”
ETag: W/”xyzzy”
ETag: “”
Location
The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion. The general syntax is:
Location: absoluteURI
Location:
The Content-Location header field differs from Location in that the Content-Location identifies the original location of the entity enclosed in the request.
Proxy-Authenticate
The Proxy-Authenticate response-header field must be included as a part of a 407 (Proxy Authentication Required) response. The general syntax is:
Proxy-Authenticate: challenge
Retry-After
The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client. The general syntax is:
Retry-After: HTTP-date | delta-seconds
Examples:
Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
Retry-After: 120
In the latter example, the delay is 2 minutes.
Server
The Server response-header field contains information about the software used by the origin server to handle the request. The general syntax is:
Server: product | comment
Server: Apache/2. 2. 14 (Win32)
If the response is being forwarded through a proxy, the proxy application must not modify the Server response-header.
Set-Cookie
The Set-Cookie response-header field contains a name/value pair of information to retain for this URL. The general syntax is:
Set-Cookie: NAME=VALUE; OPTIONS
Set-Cookie response header comprises the token Set-Cookie, followed by a comma-separated list of one or more cookies. Here are the possible values you can specify as options:
Options and Description
Comment=commentThis option can be used to specify any comment associated with the cookie.
Domain=domain The Domain attribute specifies the domain for which the cookie is valid.
Expires=Date-timeThe date the cookie will expire. If it is blank, the cookie will expire when the visitor quits the browser.
Path=pathThe Path attribute specifies the subset of URLs to which this cookie applies.
SecureIt instructs the user agent to return the cookie only under a secure connection.
Following is an example of a simple cookie header generated by the server:
Set-Cookie: name1=value1, name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT
Vary
The Vary response-header field specifies that the entity has multiple sources and may therefore vary according to the specified list of request header(s). Following is the general syntax:
Vary: field-name
You can specify multiple headers separated by commas and a value of asterisk “*” signals that unspecified parameters are not limited to the request-headers. Following is a simple example:
Vary: Accept-Language, Accept-Encoding
Here field names are case-insensitive.
WWW-Authenticate
The WWW-Authenticate response-header field must be included in 401 (Unauthorized) response messages. The field value consists of at least one challenge that indicates the authentication scheme(s) and parameters applicable to the Request-URI. The general syntax is:
WWW-Authenticate: challenge
WWW- Authenticate field value might contain more than one challenge, or if more than one WWW-Authenticate header field is provided, the contents of a challenge itself can contain a comma-separated list of authentication parameters. Following is a simple example:
WWW-Authenticate: BASIC realm=”Admin”
Entity Headers
Allow
The Allow entity-header field lists the set of methods supported by the resource identified by the Request-URI. The general syntax is:
Allow: Method
You can specify multiple methods separated by commas. Following is a simple example:
Allow: GET, HEAD, PUT
This field cannot prevent a client from trying other methods.
Content-Encoding
The Content-Encoding entity-header field is used as a modifier to the media-type. The general syntax is:
Content-Encoding: content-coding
The content-coding is a characteristic of the entity identified by the Request-URI. Following is a simple example:
Content-Encoding: gzip
If the content-coding of an entity in a request message is not acceptable to the origin server, the server should respond with a status code of 415 (Unsupported Media Type).
Content-Language
The Content-Language entity-header field describes the natural language(s) of the intended audience for the enclosed entity. Following is the general syntax:
Content-Language: language-tag
Multiple languages may be listed for content that is intended for multiple audiences. Following is a simple example:
Content-Language: mi, en
The primary purpose of Content-Language is to allow a user to identify and differentiate entities according to the user’s own preferred language.
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent, had the request been a GET. The general syntax is:
Content-Length: DIGITS
Content-Length: 3495
Any Content-Length greater than or equal to zero is a valid value.
Content-Location
The Content-Location entity-header field may be used to supply the resource location for the entity enclosed in the message when that entity is accessible from a location separate from the requested resource’s URI. The general syntax is:
Content-Location: absoluteURI | relativeURI
Content-Location:
The value of Content-Location also defines the base URI for the entity.
Content-MD5
The Content-MD5 entity-header field may be used to supply an MD5 digest of the entity for checking the integrity
of the message upon receipt. The general syntax is:
Content-MD5: md5-digest using base64 of 128 bit MD5 digest as per RFC 1864
Content-MD5: 8c2d46911f3f5a326455f0ed7a8ed3b3
The MD5 digest is computed based on the content of the entity-body, including any content-coding that has been applied, but not including any transfer-encoding applied to the message-body.
Content-Range
The Content-Range entity-header field is sent with a partial entity-body to specify where in the full entity-body the partial body should be applied. The general syntax is:
Content-Range: bytes-unit SP first-byte-pos “-” last-byte-pos
Examples of byte-content-range-spec values, assuming that the entity contains a total of 1234 bytes:
– The first 500 bytes:
Content-Range: bytes 0-499/1234
– The second 500 bytes:
Content-Range: bytes 500-999/1234
– All except for the first 500 bytes:
Content-Range: bytes 500-1233/1234
– The last 500 bytes:
Content-Range: bytes 734-1233/1234
When an HTTP message includes the content of a single range, this content is transmitted with a Content-Range header, and a Content-Length header showing the number of bytes actually transferred. For example,
HTTP/1. 1 206 Partial content
Date: Wed, 15 Nov 1995 06:25:24 GMT
Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
Content-Range: bytes 21010-47021/47022
Content-Length: 26012
Content-Type: image/gif
Content-Type
The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent, had the request been a GET. The general syntax is:
Content-Type: media-type
Following is an example:
Content-Type: text/html; charset=ISO-8859-4
Expires
The Expires entity-header field gives the date/time after which the response is considered stale. The general syntax is:
Expires: HTTP-date
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Last-Modified
The Last-Modified entity-header field indicates the date and time at which the origin server believes the variant was last modified. The general syntax is:
Last-Modified: HTTP-date
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
Frequently Asked Questions about http headers list
How many HTTP headers are there?
There are four types of HTTP message headers: General-header: These header fields have general applicability for both request and response messages. Client Request-header: These header fields have applicability only for request messages.
What are all the HTTP headers?
The HTTP Request Headers ListStandard headers. A-IM. Accept. Accept-Charset. Accept-Encoding. Accept-Language. Accept-Datetime. Access-Control-Request-Method. Access-Control-Request-Headers. Authorization. Cache-Control. Connection. Content-Length. Content-Type. Cookie. Date. … Non-standard headers. Dnt. X-Requested-With. X-CSRF-Token.Jul 28, 2018
How do I see all HTTP headers?
To view the request or response HTTP headers in Google Chrome, take the following steps :In Chrome, visit a URL, right click , select Inspect to open the developer tools.Select Network tab.Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.Jan 21, 2016