Recent from talks
Contribute something
Nothing was collected or created yet.
List of HTTP header fields
View on Wikipedia
| HTTP |
|---|
| Request methods |
| Header fields |
| Response status codes |
| Security access control methods |
| Security vulnerabilities |
HTTP header fields are a list of strings sent and received by both the client program and server on every HTTP request and response. These headers are usually invisible to the end-user and are only processed or logged by the server and client applications. They define how information sent/received through the connection are encoded (as in Content-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 or Global Privacy Control), the age (the time it has resided in a shared cache) of the document being downloaded, amongst others.
General format
[edit]In HTTP version 1.x, 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 was deprecated in RFC 7230.[1]
HTTP/2[2] and HTTP/3 instead use a binary protocol, where headers are encoded in a single HEADERS and zero or more CONTINUATION frames using HPACK[3] (HTTP/2) or QPACK (HTTP/3), which both provide efficient header compression. The request or response line from HTTP/1 has also been replaced by several pseudo-header fields, each beginning with a colon (:).
Field names
[edit]A core set of fields is standardized by the Internet Engineering Task Force (IETF) in RFC 9110 and 9111. The Field Names, 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.[4] This is in contrast to HTTP method names (GET, POST, etc.), which are case-sensitive.[5]
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.[6] An earlier restriction on use of Downgraded- was lifted in March 2013.[7]
Field values
[edit]A few fields can contain comments (i.e. in User-Agent, Server, Via fields), which can be ignored by software.[8]
Many field values may contain a quality (q) key-value pair separated by equals sign, specifying a weight to use in content negotiation.[9] 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.[10]
Request fields
[edit]Standard request fields
[edit]| Name | Description | Example | Status | Standard |
|---|---|---|---|---|
| A-IM | Acceptable instance-manipulations for the request.[11] | A-IM: feed |
Permanent | RFC 3229 |
| Accept | Media type(s) that is/are acceptable for the response. See Content negotiation. | Accept: text/html |
Permanent | RFC 9110 |
| Accept-Charset | Character sets that are acceptable. | Accept-Charset: utf-8 |
Permanent | RFC 9110 |
| 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 |
Permanent | RFC 9110 |
| Accept-Language | List of acceptable human languages for response. See Content negotiation. | Accept-Language: en-US |
Permanent | RFC 9110 |
| Access-Control-Request-Method, Access-Control-Request-Headers[12] |
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== |
Permanent | RFC 9110 |
| Cache-Control | Used to specify directives that must be obeyed by all caching mechanisms along the request-response chain. | Cache-Control: no-cache |
Permanent | RFC 9111 |
| Connection | Control options for the current connection and list of hop-by-hop request fields.[13]
Must not be used with HTTP/2.[14] |
Connection: keep-alive
|
Permanent | RFC 9110 |
| Content-Encoding | The type of encoding used on the data. See HTTP compression. | Content-Encoding: gzip |
Permanent | RFC 9110 |
| Content-Length | The length of the request body in octets (8-bit bytes). | Content-Length: 348 |
Permanent | RFC 9110 |
| Content-MD5 | A Base64-encoded binary MD5 sum of the content of the request body. | Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== |
Obsolete[15] | RFC 1544, 1864, 4021 |
| Content-Type | The Media type of the body of the request (used with POST and PUT requests). | Content-Type: application/x-www-form-urlencoded |
Permanent | RFC 9110 |
| Cookie | An HTTP cookie previously sent by the server with Set-Cookie (below). |
Cookie: $Version=1; Skin=new; |
Permanent: standard | RFC 2965, 6265 |
| Date | The date and time at which the message was originated (in "HTTP-date" format as defined by RFC 9110: HTTP Semantics, section 5.6.7 "Date/Time Formats"). | Date: Tue, 15 Nov 1994 08:12:31 GMT |
Permanent | RFC 9110 |
| Expect | Indicates that particular server behaviors are required by the client. | Expect: 100-continue |
Permanent | RFC 9110 |
| Forwarded | Disclose original information of a client connecting to a web server through an HTTP proxy.[16] | Forwarded: for=192.0.2.60;proto=http;by=203.0.113.43 Forwarded: for=192.0.2.43, for=198.51.100.17 |
Permanent | RFC 7239 |
| From | The email address of the user making the request. | From: user@example.com |
Permanent | RFC 9110 |
| 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.[17] If the request is generated directly in HTTP/2, it should not be used.[18] |
Host: en.wikipedia.org:8080
|
Permanent | RFC 9110, 9113 |
| HTTP2-Settings | A request that upgrades from HTTP/1.1 to HTTP/2 MUST include exactly one HTTP2-Settings 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.[19][20]
|
HTTP2-Settings: token64
|
Obsolete | RFC 7540, 9113 |
| 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" |
Permanent | RFC 9110 |
| 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 |
Permanent | RFC 9110 |
| If-None-Match | Allows a 304 Not Modified to be returned if content is unchanged, see HTTP ETag. | If-None-Match: "737060cd8c284d8af7ad3082f209582d" |
Permanent | RFC 9110 |
| 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" |
Permanent | RFC 9110 |
| 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 |
Permanent | RFC 9110 |
| Max-Forwards | Limit the number of times the message can be forwarded through proxies or gateways. | Max-Forwards: 10 |
Permanent | RFC 9110 |
| Origin[12] | Initiates a request for cross-origin resource sharing (asks server for Access-Control-* response fields). | Origin: http://www.example-social-network.com |
Permanent: standard | RFC 6454 |
| Pragma | Implementation-specific fields that may have various effects anywhere along the request-response chain. | Pragma: no-cache |
Outdated | RFC 9111 |
| Prefer | Allows client to request that certain behaviors be employed by a server while processing a request. | Prefer: return=representation
|
Permanent | RFC 7240 |
| Proxy-Authorization | Authorization credentials for connecting to a proxy. | Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
Permanent | RFC 9110 |
| Range | Request only part of an entity. Bytes are numbered from 0. See Byte serving. | Range: bytes=500-999 |
Permanent | RFC 9110 |
| 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: http://en.wikipedia.org/wiki/Main_Page |
Permanent | RFC 9110 |
| 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 |
TE: trailers, deflate |
Permanent | RFC 9110 |
| 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
|
Permanent | RFC 9110 |
| Transfer-Encoding | The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity.
Must not be used with HTTP/2.[14] |
Transfer-Encoding: chunked
|
Permanent | RFC 9110 |
| 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 |
Permanent | RFC 9110 |
| Upgrade | Ask the server to upgrade to another protocol.
Must not be used in HTTP/2.[14] |
Upgrade: h2c, HTTPS/1.3, IRC/6.9, RTA/x11, websocket |
Permanent | RFC 9110 |
| Via | Informs the server of proxies through which the request was sent. | Via: 1.0 fred, 1.1 example.com (Apache/1.1) |
Permanent | RFC 9110 |
| Warning | A general warning about possible problems with the entity body. | Warning: 199 Miscellaneous warning |
Obsolete[21] | RFC 7234, 9111 |
Common non-standard request fields
[edit]| Field name | Description | Example |
|---|---|---|
| Upgrade-Insecure-Requests[22] | 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
|
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[23] |
X-Requested-With: XMLHttpRequest
|
| DNT[24] | 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.[25] On March 7, 2011, a draft proposal was submitted to IETF.[26] The W3C Tracking Protection Working Group is producing a specification.[27] | DNT: 1 (Do Not Track Enabled)
|
| X-Forwarded-For[28] | 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-Host[29] | 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: en.wikipedia.org:8080
|
| X-Forwarded-Proto[30] | 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: https
|
| Front-End-Https[31] | Non-standard header field used by Microsoft applications and load-balancers | Front-End-Https: on
|
| X-Http-Method-Override[32] | 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 (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[33] | 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[34] | 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: http://wap.samsungmobile.com/uaprof/SGH-I777.xml
|
| Proxy-Connection[35] | 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.
Must not be used with HTTP/2.[14] |
Proxy-Connection: keep-alive
|
| X-UIDH[36][37][38] | Server-side deep packet inspection of a unique ID identifying customers of Verizon Wireless; also known as "perma-cookie" or "supercookie" | X-UIDH: ...
|
| X-Csrf-Token[39] | Used to prevent cross-site request forgery. Alternative header names are: X-CSRFToken[40] and X-XSRF-TOKEN[41] |
X-Csrf-Token: i8XNjC4b8KVok4uw5RftR38Wgp2BFwql
|
| X-Request-ID,[stackoverflow2 1][42] | Correlates HTTP requests between a client and server. Superseded by the traceparent header | X-Request-ID: f058ebd6-02f7-4d3f-942e-904344e8cde5
|
| Save-Data[46] | 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
|
| Sec-GPC[47] | The Sec-GPC (Global Privacy Control[broken anchor]) request header indicates whether the user consents to a website or service selling or sharing their personal information with third parties. | Sec-GPC: 1
|
Response fields
[edit]Standard response fields
[edit]| Field name | Description | Example | Status | Standard |
|---|---|---|---|---|
| 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[12] |
Specifying which web sites can participate in cross-origin resource sharing | Access-Control-Allow-Origin: * |
Permanent: standard | RFC 7480 |
| Accept-Patch[48] | Specifies which patch document formats this server supports | Accept-Patch: text/example;charset=utf-8 |
Permanent | RFC 5789 |
| Accept-Ranges | What partial content range types this server supports via byte serving | Accept-Ranges: bytes |
Permanent | RFC 9110 |
| Age | The age the object has been in a proxy cache in seconds | Age: 12 |
Permanent | RFC 9111 |
| Allow | Valid methods for a specified resource. To be used for a 405 Method not allowed | Allow: GET, HEAD |
Permanent | RFC 9110 |
| Alt-Svc[49] | 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.[50] |
Alt-Svc: http/1.1="http2.example.com:8001"; ma=7200 |
Permanent | |
| Cache-Control | Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds | Cache-Control: max-age=3600 |
Permanent | RFC 9111 |
| Connection | Control options for the current connection and list of hop-by-hop response fields.[13]
Must not be used with HTTP/2.[14] |
Connection: close |
Permanent | RFC 9110 |
| Content-Disposition[51] | 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="fname.ext" |
Permanent | RFC 2616, 4021, 6266 |
| Content-Encoding | The type of encoding used on the data. See HTTP compression. | Content-Encoding: gzip |
Permanent | RFC 9110 |
| Content-Language | The natural language or languages of the intended audience for the enclosed content[52] | Content-Language: da |
Permanent | RFC 9110 |
| Content-Length | The length of the response body in octets (8-bit bytes) | Content-Length: 348 |
Permanent | RFC 9110 |
| Content-Location | An alternate location for the returned data | Content-Location: /index.htm |
Permanent | RFC 9110 |
| Content-MD5 | A Base64-encoded binary MD5 sum of the content of the response | Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== |
Obsolete[15] | RFC 1544, 1864, 4021 |
| Content-Range | Where in a full body message this partial message belongs | Content-Range: bytes 21010-47021/47022 |
Permanent | RFC 9110 |
| Content-Type | The MIME type of this content | Content-Type: text/html; charset=utf-8 |
Permanent | RFC 9110 |
| Date | The date and time that the message was sent (in "HTTP-date" format as defined by RFC 9110) | Date: Tue, 15 Nov 1994 08:12:31 GMT |
Permanent | RFC 9110 |
| Delta-Base | Specifies the delta-encoding entity tag of the response.[11] | Delta-Base: "abc" |
Permanent | RFC 3229 |
| ETag | An identifier for a specific version of a resource, often a message digest | ETag: "737060cd8c284d8af7ad3082f209582d" |
Permanent | RFC 9110 |
| Expires | Gives the date/time after which the response is considered stale (in "HTTP-date" format as defined by RFC 9110) | Expires: Thu, 01 Dec 1994 16:00:00 GMT |
Permanent: standard | RFC 9111 |
| IM | Instance-manipulations applied to the response.[11] | IM: feed |
Permanent | RFC 3229 |
| Last-Modified | The last modified date for the requested object (in "HTTP-date" format as defined by RFC 9110) | Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT |
Permanent | RFC 9110 |
| Link | Used to express a typed relationship with another resource, where the relation type is defined by RFC 8288 | Link: </feed>; rel="alternate"[53] |
Permanent | RFC 8288 |
| Location | Used in redirection, or when a new resource has been created. |
|
Permanent | RFC 9110 |
| P3P | This field is supposed to set P3P policy, in the form of P3P:CP="your_compact_policy". However, P3P did not take off,[54] 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 https://en.wikipedia.org/wiki/Special:CentralAutoLogin/P3P for more info." |
Permanent | |
| Pragma | Implementation-specific fields that may have various effects anywhere along the request-response chain. | Pragma: no-cache |
Permanent | RFC 9111 |
| Preference-Applied | Indicates which Prefer tokens were honored by the server and applied to the processing of the request. | Preference-Applied: return=representation
|
Permanent | RFC 7240 |
| Proxy-Authenticate | Request authentication to access the proxy. | Proxy-Authenticate: Basic |
Permanent | RFC 9110 |
| Public-Key-Pins[55] | HTTP Public Key Pinning, announces hash of website's authentic TLS certificate | Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; |
Permanent | RFC 7469 |
| 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.[56] |
|
Permanent |
RFC 9110 |
| Server | A name for the server | Server: Apache/2.4.1 (Unix) |
Permanent | RFC 9110 |
| Set-Cookie | An HTTP cookie | Set-Cookie: CookieName=CookieValue; Max-Age=3600; Version=1 |
Permanent: standard | RFC 6265 |
| 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 |
Permanent: standard | |
| 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 |
Permanent | RFC 9110 |
| Transfer-Encoding | The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity.
Must not be used with HTTP/2.[14] |
Transfer-Encoding: chunked |
Permanent | RFC 9110 |
| 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: ?
|
Permanent | |
| Upgrade | Ask the client to upgrade to another protocol.
Must not be used in HTTP/2[14] |
Upgrade: h2c, HTTPS/1.3, IRC/6.9, RTA/x11, websocket |
Permanent | RFC 9110 |
| 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. |
|
Permanent | RFC 9110 |
| Via | Informs the client of proxies through which the response was sent. | Via: 1.0 fred, 1.1 example.com (Apache/1.1) |
Permanent | RFC 9110 |
| Warning | A general warning about possible problems with the entity body. | Warning: 199 Miscellaneous warning |
Obsolete[21] | RFC 7234, 9111 |
| WWW-Authenticate | Indicates the authentication scheme that should be used to access the requested entity. | WWW-Authenticate: Basic |
Permanent | RFC 9110 |
| X-Frame-Options[57] | 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[58] |
Common non-standard response fields
[edit]| Field name | Description | Example |
|---|---|---|
| Content-Security-Policy, X-Content-Security-Policy, X-WebKit-CSP[59] |
Content Security Policy definition. | X-WebKit-CSP: default-src 'self'
|
| Expect-CT[60] | Notify to prefer to enforce Certificate Transparency. | Expect-CT: max-age=604800, enforce, report-uri="https://example.example/report"
|
| NEL[61] | 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[62] | To allow or disable different features or APIs of the browser. | Permissions-Policy: fullscreen=(), camera=(), microphone=(), geolocation=(), interest-cohort=()[63]
|
| Refresh | Tells the browser to refresh the page or redirect to a different URL, after a given number of seconds (0 meaning immediately); or when a new resource has been created[clarification needed]. Header introduced by Netscape in 1995 and became a de facto standard supported by most web browsers. Eventually standardized in the HTML Living Standard in 2017.[64] |
Refresh: 5; url=http://www.w3.org/pub/WWW/People.html
|
| Report-To[65] | Instructs the user agent to store reporting endpoints for an origin. | Report-To: { "group": "csp-endpoint", "max_age": 10886400, "endpoints": [ { "url": "https-url-of-site-which-collects-reports" } ] }
|
| Status | CGI header field specifying the status of the HTTP response. Normal HTTP responses use a separate "Status-Line" instead, defined by RFC 9110.[66] | 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.[67]
|
Timing-Allow-Origin: *
|
| X-Content-Duration[68] | Provide the duration of the audio or video in seconds. Not supported by current browsers – the header was only supported by Gecko browsers, from which support was removed in 2015.[69] | X-Content-Duration: 42.666
|
| X-Content-Type-Options[70] | 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.[71] | X-Content-Type-Options: nosniff[72]
|
| X-Powered-By[stackoverflow1 1] | Specifies the technology (e.g. ASP.NET, PHP, JBoss) supporting the web application (version details are often in X-Runtime, X-Version, or X-AspNet-Version) |
X-Powered-By: PHP/5.4.0
|
| X-Redirect-By[73] | Specifies the component that is responsible for a particular redirect. | X-Redirect-By: WordPressX-Redirect-By: Polylang
|
| X-Request-ID, X-Correlation-ID[stackoverflow2 1] | Correlates HTTP requests between a client and server. | X-Request-ID: f058ebd6-02f7-4d3f-942e-904344e8cde5
|
| X-UA-Compatible[74] | 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.[75] |
X-UA-Compatible: IE=edgeX-UA-Compatible: IE=EmulateIE7X-UA-Compatible: Chrome=1
|
| X-XSS-Protection[76] | 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.[77] The behavior of Pragma: no-cache in a response is implementation specific. While some user agents do pay attention to this field in responses,[78] the HTTP/1.1 RFC specifically warns against relying on this behavior.
See also
[edit]References
[edit]- ^ "Field Parsing". Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. sec. 3.2.4. doi:10.17487/RFC7230. RFC 7230.
- ^ HTTP/2. June 2022. doi:10.17487/RFC9113. RFC 9113.
- ^ Peon, R.; Ruellan, H. (May 2015). HPACK: Header Compression for HTTP/2. doi:10.17487/RFC7541. RFC 7541.
- ^ "Field Names". HTTP Semantics. June 2022. sec. 5.1. doi:10.17487/RFC9110. RFC 9110.
- ^ "Methods: Overview". HTTP Semantics. June 2022. sec. 9.1. doi:10.17487/RFC9110. RFC 9110.
- ^ Saint-Andre, P.; Crocker, D.; Nottingham, M. (June 1, 2012). Deprecating the "X-" Prefix and Similar Constructs in Application Protocols. doi:10.17487/RFC6648. RFC 6648.
- ^ "Message Headers". Iana.org. June 11, 2014. Retrieved June 12, 2014.
- ^ "Comments". HTTP Semantics. June 2022. sec. 5.6.5. doi:10.17487/RFC9110. RFC 9110.
- ^ "Quality Values". HTTP Semantics. June 2022. sec. 12.4.2. doi:10.17487/RFC9110. RFC 9110.
- ^ "core - Apache HTTP Server". Httpd.apache.org. 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 "Connection header". HTTP Semantics. June 2022. sec. 7.6.1. doi:10.17487/RFC9110. RFC 9110.
- ^ a b c d e f g h "Connection-Specific Header Fields". HTTP/2. June 2022. sec. 8.2.2. doi:10.17487/RFC9113. RFC 9113.
- ^ a b "Changes from RFC 2616". Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. sec. B. doi:10.17487/RFC7231. RFC 7231.
- ^ Petersson, A.; Nilsson, M. (June 2014). Forwarded HTTP Extension: Introduction. IETF. doi:10.17487/RFC7239. RFC 7239.
- ^ "Host and :authority". HTTP Semantics. June 2022. sec. 7.2. doi:10.17487/RFC9110. RFC 9110.
- ^ "Request Pseudo-Header Fields". HTTP/2. June 2022. sec. 8.3.1. doi:10.17487/RFC9113. RFC 9113.
- ^ "Message Headers". www.iana.org. Retrieved November 26, 2018.
- ^ "HTTP2-Settings Header Field". Hypertext Transfer Protocol Version 2 (HTTP/2). sec. 3.2.1. doi:10.17487/RFC7540. RFC 7540.
- ^ a b "Warning header". HTTP Caching. June 2022. sec. 5.5. doi:10.17487/RFC9111. RFC 9111.
- ^ "Upgrade Insecure Requests - W3C Candidate Recommendation". W3C. October 8, 2015. Retrieved January 14, 2016.
- ^ "The "X-Requested-With" Header – Stoutner". October 31, 2022.
- ^ "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". Archived from the original on October 23, 2016. 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.
- ^ "HTTP Request IDs". devcenter.heroku.com. Retrieved March 22, 2022.
- ^ "The Value of Correlation IDs". Rapid7 Blog. December 23, 2016. Retrieved April 13, 2018.
- ^ Hilton, Peter (July 12, 2017). "Correlation IDs for microservices architectures - Peter Hilton". hilton.org.uk. Retrieved April 13, 2018.
- ^ "W3C Trace Context". w3c.org. Retrieved June 19, 2024.
- ^ "Save Data API Living Document Draft Community Group Report 2.1.1. Save-Data Request Header Field". Web Platform Incubator Community Group. June 30, 2020. Retrieved March 5, 2021.
- ^ MDN contributors (March 3, 2023). "Sec-GPC". MDN Web Docs. Retrieved March 12, 2023.
- ^ Dusseault, L.; Snell, J. (2010). PATCH Method for HTTP. doi:10.17487/RFC5789. RFC 5789.
- ^ Nottingham, M.; McManus, P.; Reschke, J. (April 2016). HTTP Alternative Services. IETF. doi:10.17487/RFC7838. RFC 7838.
- ^ Nottingham, M.; McManus, P.; Reschke, J. (April 2016). HTTP Alternative Services, section 3. IETF. doi:10.17487/RFC7838. RFC 7838.
- ^ Reschke, J. (2011). Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP). doi:10.17487/RFC6266. RFC 6266.
- ^ "Content-Language". HTTP Semantics. June 2022. sec. 8.5. doi:10.17487/RFC9110. RFC 9110.
- ^ 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". IETF. Retrieved April 17, 2015.
- ^ "Retry-After". HTTP Semantics. June 2022. sec. 10.2.3. doi:10.17487/RFC9110. RFC 9110.
- ^ Ross, D.; Gondrom, T. (2013). HTTP Header Field X-Frame-Options. IETF. doi:10.17487/RFC7034. RFC 7034.
- ^ "Content Security Policy Level 2". Retrieved August 2, 2014.
- ^ "Content Security Policy". W3C. 2012. Retrieved April 28, 2017.
- ^ "Expect-CT". Mozilla Developer Network. Retrieved July 23, 2021.
- ^ "NEL". Mozilla Developer Network. 2021. Retrieved May 18, 2021.
- ^ "Permissions Policy". W3C. 2020. Retrieved May 1, 2021.
- ^ "Am I FLoCed?". EFF. 2021. 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". Mozilla Developer Network. 2021. Retrieved May 18, 2021.
- ^ RFC 9110: HTTP Semantics
- ^ "Timing-Allow-Origin". Mozilla Developer Network. Retrieved January 25, 2018.
- ^ "Configuring servers for Ogg media". May 26, 2014. Retrieved January 3, 2015.
- ^ "Clean up duration tracking and use mirroring for cross-thread access". Bugzilla@Mozilla. Retrieved February 9, 2024.
- ^ 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.
- ^ "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.2.5.3 Pragma directives, X-UA-Compatible state". WHATWG. March 12, 2021. Retrieved March 14, 2021.
For meta elements with an http-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.
- ^ "Pragme". HTTP Caching. June 2022. sec. 5.4. doi:10.17487/RFC9111. RFC 9111.
- ^ "How to prevent caching in Internet Explorer". Microsoft. September 22, 2011. Retrieved April 15, 2015.
As of this edit, this article uses content from "What is the X-REQUEST-ID http header?", authored by Stefan Kögl at Stack Exchange, which is licensed in a way that permits reuse under the Creative Commons Attribution-ShareAlike 3.0 Unported License, but not under the GFDL. All relevant terms must be followed.
- ^ a b "What is the X-REQUEST-ID http header?". Retrieved March 20, 2022.
As of this edit, this article uses content from "Why does ASP.NET framework add the 'X-Powered-By:ASP.NET' HTTP Header in responses?", authored by Adrian Grigore at Stack Exchange, which is licensed in a way that permits reuse under the Creative Commons Attribution-ShareAlike 3.0 Unported License, but not under the GFDL. All relevant terms must be followed.
- ^ "Why does ASP.NET framework add the 'X-Powered-By:ASP.NET' HTTP Header in responses? - Stack Overflow". Retrieved March 20, 2022.
External links
[edit]- Headers: Permanent Message Header Field Names
- RFC 6265: IETF HTTP State Management Mechanism
- RFC 9110: HTTP Semantics
- RFC 9111: HTTP Caching
- RFC 9112: HTTP/1.1
- RFC 9113: HTTP/2
- RFC 9114: HTTP/3
- 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
List of HTTP header fields
View on GrokipediaFundamentals
General Format
HTTP header fields consist of a case-insensitive field name followed by a colon (":") and a field value, with optional whitespace (OWS) permitted before and after the field name, between the colon and the field value, and at the end of the field value; this OWS is semantically insignificant and ignored during parsing.[3] The overall syntax is defined asfield-line = field-name ":" OWS field-value OWS, where the field name is a token (a sequence of characters excluding control characters and separators) and the field value is a sequence of field content or OWS.[4] For instance, a basic header might appear as Host: example.com, Host : example.com (with leading OWS after the name), or Host:example.com (with no OWS around the value), all of which are equivalent.[3]
Field values exceeding a single line can employ line folding, where a sender inserts a carriage return and line feed (CRLF) followed by OWS to continue the value on the next line; recipients unfold these by replacing the CRLF and OWS with a single space or removing them entirely, preserving the original value order.[5] This mechanism, introduced in earlier HTTP specifications and retained for compatibility, allows for more readable transmission of long values without altering semantics. Field names are case-insensitive (e.g., "Content-Type" and "content-type" refer to the same field), but field values are case-sensitive unless the specific field definition states otherwise.[6]
The general format originated in HTTP/1.1, where header fields were transmitted as plain text lines in messages, as specified in RFC 7230 (now obsoleted by RFC 9110 and RFC 9112). In HTTP/2, this textual representation is abstracted away by a binary framing layer, where headers are compressed using HPACK and sent in HEADERS or PUSH_PROMISE frames, hiding the traditional line-based format from the wire protocol while maintaining semantic equivalence. HTTP/3 further evolves this by mapping headers onto QUIC streams, employing QPACK compression instead of HPACK to accommodate QUIC's stream-based, unordered delivery, ensuring efficient transmission without relying on the original text syntax.
Field Names and Values
HTTP header field names are case-insensitive strings composed of one or more token characters, which include uppercase and lowercase letters (A-Z, a-z), digits (0-9), and a limited set of symbols such as hyphen (-), exclamation mark (!), hash (#), dollar sign ($), percent (%), ampersand (&), single quote ('), asterisk (*), plus (+), period (.), caret (^), underscore (_), grave accent (`), vertical bar (|), and tilde (~), while excluding spaces, control characters, and delimiters like parentheses or commas.[7] By convention, field names use lowercase letters separated by hyphens to form multi-word identifiers, such as "content-type" or "user-agent", enhancing readability and consistency across implementations.[8] All field names must be registered in the Internet Assigned Numbers Authority (IANA) Hypertext Transfer Protocol (HTTP) Field Name Registry to avoid collisions and ensure interoperability; permanent registrations require a formal specification and IETF review, while provisional registrations undergo expert review for temporary or experimental use.[2][9] The use of the "X-" prefix for provisional or experimental field names, once common to denote non-standard extensions, has been deprecated since 2012 to prevent namespace pollution and simplify standardization, with implementers advised against making assumptions based solely on the prefix's presence.[10] Since the early implementations of CORS in major browsers (around 2010-2014), "X-" prefixed headers are treated as non-simple and trigger preflight requests unless explicitly allowed by the server via Access-Control-Allow-Headers. Field values follow flexible syntax to accommodate various data types, primarily as tokens for simple identifiers, quoted-strings for text containing special characters, comma-separated lists for multiple items, and parameters for key-value extensions.[11] A token is a sequence of one or more allowed characters without spaces or delimiters, suitable for concise values like directives; for example, theCache-Control header uses the token value no-cache to indicate that a response must not be used from a cache without revalidation.[7] A quoted-string encloses arbitrary text in double quotes, allowing escaped special characters (e.g., via backslash) within the quotes, which is useful for values with spaces or reserved symbols.[12]
Comma-separated lists enable multiple values in a single field, often with optional whitespace around commas, as seen in headers like Accept that list supported media types.[13] Parameters append semicolon-separated name-value pairs to a base value, where the value can be a token or quoted-string; a common example is the q-value parameter in quality-prefixed lists, ranging from 0 to 1 with up to three decimal places to express preference levels.[14] For instance, the Accept header might specify text/[html](/page/HTML);q=0.8 to indicate a moderate preference for HTML content over other types.[15] These value types build on the general BNF syntax for HTTP messages, allowing parsers to handle structured content reliably while supporting extensibility through registered parameters.[11]
Size Limits and Constraints
HTTP does not impose a strict limit on the size of individual header fields or the total header section in its core specifications. According to RFC 7230 for HTTP/1.1, there is no predefined maximum length for header fields or the overall header block, allowing implementations flexibility while expecting reasonable bounds to prevent resource exhaustion. In practice, web servers enforce per-header limits to mitigate denial-of-service risks; for instance, Apache HTTP Server defaults to 8190 bytes per header field via the LimitRequestFieldSize directive. Similarly, NGINX configures a default buffer of 8 KB for client request headers through large_client_header_buffers (typically set to 4 buffers of 8 KB each, enabling up to 32 KB total but often effectively limited to 8 KB without adjustment). For total header sizes in HTTP/1.1, no formal recommendation exists in the RFCs, but common implementations cap the aggregate at around 8 KB to balance performance and security. HTTP/2 introduces more structured constraints via its binary framing and header compression (HPACK). The initial flow-control window size is 65,535 octets (64 KiB), limiting the amount of header data that can be sent before acknowledgment, while the SETTINGS_HEADER_TABLE_SIZE parameter defaults to 4 KB for the compression table but can be negotiated up to 65 KB.[16] Additionally, SETTINGS_MAX_HEADER_LIST_SIZE defaults to an effectively unlimited value (2^31 - 1 bytes), though servers may impose lower practical limits to avoid excessive memory use. HTTP/3, built over QUIC (RFC 9000), inherits similar flexibility but adds transport-layer considerations. Implementations may limit header sizes per message, with no fixed cap in RFC 9114, but the protocol's HEADERS frames support payloads up to 2^62 bytes in theory; practical deployments often restrict to around 16 KB to align with QUIC's stream flow control and avoid fragmentation.[17] QUIC's frame sizing further constrains headers within stream frames, typically bounded by the connection's maximum datagram size (default 1200 bytes minimum, up to 64 KB MTU). Line length limits persist from HTTP/1.1 roots; Apache enforces a maximum of 8190 characters per header line, while other servers like NGINX use buffer-based parsing without a hard character cap but reject overflows via configuration. Oversized headers trigger specific error handling to maintain robustness. Servers respond with HTTP 400 Bad Request for general parsing failures, but RFC 6585 defines status code 431 Request Header Fields Too Large specifically for cases where the total request header exceeds server limits, prompting clients to reduce header size. This status is widely adopted in modern servers, including NGINX and Apache, to provide clearer feedback than a generic 400.Request Fields
Standard Request Fields
Standard request fields encompass the officially standardized HTTP header fields, as defined primarily in RFC 9110, that clients include in requests to convey essential metadata to servers, such as target identification, client capabilities, authentication details, and state information.[18] These fields enable core protocol functionality, including resource location, content negotiation, conditional processing for caching, and session management, while evolving with protocol versions like HTTP/2 and HTTP/3 to use pseudo-headers for efficiency.[19] Among the core fields, the Host header is mandatory for HTTP/1.1 requests and specifies the Internet host and port number of the resource being requested, allowing servers to route requests to the correct virtual host.[20] It takes the form of a host name followed optionally by a colon and port number, such asHost: example.com:8080.[20] In HTTP/2 and HTTP/3, the :authority pseudo-header replaces the Host header, carrying the same authority component but defined as a required pseudo-header field prefixed with a colon to distinguish it from regular headers. The :method pseudo-header, also mandatory in HTTP/2 and HTTP/3 requests, explicitly declares the HTTP method (e.g., GET, POST) as the first header field sent, mapping directly to the traditional method line in HTTP/1.1.
The User-Agent header identifies the client software originating the request, typically including the application name, version, and operating system details to aid servers in optimization and debugging, such as User-Agent: [Mozilla](/page/Mozilla)/5.0 ([Windows NT](/page/Windows_NT) 10.0; Win64; x64).[21] Servers use this for analytics and compatibility checks, though clients are encouraged to limit details to mitigate privacy risks like fingerprinting.[21] The Accept header signals the media types acceptable in the response, using type/subtype pairs with quality factors (e.g., Accept: text/html;q=1.0, application/[json](/page/JSON);q=0.8), enabling proactive content negotiation based on client preferences.[22]
For authentication, the Authorization header transmits credentials to access protected resources, formatted as a scheme followed by encoded credentials (e.g., Authorization: Basic <base64-encoded username:password>), sent in response to a 401 challenge.[23] It supports various authentication schemes like Basic, Digest, or Bearer tokens for APIs.[23] The Cookie header maintains client-side state by returning cookies previously set by the server via Set-Cookie responses, formatted as name-value pairs separated by semicolons (e.g., Cookie: sessionid=abc123; theme=dark), allowing stateless HTTP to simulate sessions.
Conditional request fields facilitate efficient caching and resource validation. The If-None-Match header provides one or more entity tags (ETags) to check if the resource has changed, using weak or strong validators; if the server's current ETag matches, it returns 304 Not Modified instead of the full body.[24] Similarly, If-Modified-Since conditions a GET or HEAD request on the resource's last modification date, specified in HTTP-date format (e.g., If-Modified-Since: Sat, 1 Jan 2022 00:00:00 GMT), triggering a 304 response if unchanged since that time.[25] These fields, when combined, prioritize ETag over date-based checks for precision.[25]
The Expect header signals client expectations for the server to confirm before proceeding, such as Expect: 100-continue before sending large request bodies. Servers must either send 100 Continue if the expectation is supported or 417 Expectation Failed if not; support for expectations like 100-continue is optional.[26] For data conservation, the Save-Data header, introduced as a client hint in 2021, indicates the user's preference for reduced data usage (e.g., Save-Data: on) to prompt servers to deliver lighter responses, such as lower-resolution images.[27] Fetch metadata headers like Sec-Fetch-Site, Sec-Fetch-Mode, Sec-Fetch-Dest, and Sec-Fetch-User, standardized since 2018, provide servers with contextual details about the request's origin and purpose (e.g., Sec-Fetch-Site: same-origin or Sec-Fetch-Mode: navigate) to enhance security decisions, such as blocking cross-site attacks.[28] In HTTP/3, these standard request fields retain the same semantics as in prior versions, with pseudo-headers like :method and :authority integrated into the QUIC-framed messages for improved performance over unreliable networks.
Common Non-Standard Request Fields
Non-standard HTTP request headers, often prefixed with "X-" or used in vendor-specific contexts, have emerged to address practical needs not covered by official RFCs, such as proxy chaining and privacy signaling, though they lack universal interoperability and are sometimes deprecated in favor of standardized alternatives.[29] These headers are commonly implemented by web servers, proxies, and client libraries but can lead to inconsistencies across systems due to their unofficial status.[30] One prominent example is the X-Forwarded-For header, which discloses the original client IP address when requests pass through proxies or load balancers, originating from Apache HTTP Server implementations to preserve client identification in proxied environments.[30] This header appends IP addresses in a comma-separated list, with the leftmost being the initial client, but its non-standard format has prompted security risks like spoofing, leading to recommendations for migration to the standardized Forwarded header defined in RFC 7239.[29] The X-Requested-With header, popularized by the jQuery library for detecting AJAX requests by setting its value to "XMLHttpRequest," allows servers to differentiate asynchronous calls from standard navigation, aiding in tailored responses like JSON payloads.[31] However, reliance on this non-standard header has been discouraged since around 2020 due to privacy concerns and lack of broad adoption, with modern alternatives like the Sec-Fetch-Mode header (part of Fetch Metadata Request Headers) providing standardized mode indicators such as "cors" or "navigate."[32] In 2023, Google's Android WebView introduced an opt-in requirement for sending X-Requested-With to enhance user privacy during deprecation trials; however, these changes were later cancelled, and as of 2025, the header is sent by default on all requests.[33][34] The Do Not Track (DNT) header, proposed by the W3C as a mechanism for users to signal privacy preferences against third-party tracking via a value of "1," represents an early attempt at standardized opt-out but remains a draft without full ratification, with adoption waning as browsers like Safari and Firefox discontinued support by 2025.[35][36] Despite its non-binding nature, DNT persists in some implementations to communicate user intent for reduced data collection.[35] Vendor-specific extensions include the Sec-CH-UA header family, introduced by Google Chrome in 2020 as part of User-Agent Client Hints to mitigate fingerprinting risks from the traditional User-Agent string, allowing servers to request granular details like browser brand and version only when explicitly opted into via the Accept-CH response header.[37] This approach prioritizes privacy by reducing passive information leakage, with headers like Sec-CH-UA-Mobile indicating device type.[38] More recently, the Global Privacy Control (GPC) header, a proposed specification from 2022 onward backed by privacy advocacy groups, sends a "1" value in requests to enforce user opt-out signals across sites, integrating with laws like CCPA and serving as a one-click privacy tool in supported browsers.[39] GPC operates via the GPC request header to signal global consent preferences, though its implementation varies and it complements rather than replaces other privacy mechanisms. Overall, while these non-standard request fields enable practical functionality in diverse ecosystems, their use introduces interoperability challenges and potential security vulnerabilities, underscoring the importance of transitioning to RFC-defined headers like Forwarded for long-term reliability.[29]Response Fields
Standard Response Fields
Standard response fields in HTTP are header fields defined in RFCs and registered with the IANA as permanent or provisional, sent by servers to convey metadata, status information, and instructions to clients in responses. These fields play a crucial role in enabling proper interpretation of the response, managing caching, handling redirects, and providing diagnostic details, distinct from request fields which originate from clients. They adhere to the general HTTP header syntax, where field names are case-insensitive and values follow specific formats outlined in relevant RFCs.[40] Among the core standard response fields, the Server field indicates the origin server software that handled the request, such as "Apache/2.4.41 (Ubuntu)", to aid in debugging and compatibility checks. The Date field provides the date and time at which the origin server believes the message was generated, formatted as an HTTP-date in Greenwich Mean Time, ensuring synchronized timestamps across systems. The Content-Type field specifies the media type and optional charset of the representation in the response body, like "text/html; charset=UTF-8", allowing clients to process the content appropriately. The Set-Cookie field instructs the client to store a cookie, containing a name-value pair and attributes like expiration and path, to maintain state across requests. For redirects, the Location field provides the URI of the target resource, mandatory in responses with 3xx status codes to indicate where the client should proceed. Caching-related standard response fields control how and for how long responses are stored by intermediaries and clients. The Cache-Control field carries directives such as "max-age=3600" or "no-cache", dictating caching behavior to balance performance and freshness. The Expires field sets an absolute expiration date and time for the response, using HTTP-date format, after which the cached representation is considered stale. The ETag field assigns a unique opaque validator, often an entity tag like "686897696a7c876b7e", for conditional requests to verify if the representation has changed. Additional standard fields address variability, logging, alternatives, and protocol-specific elements. The Vary field lists request header fields, such as "Accept-Encoding", that influence the selected representation, ensuring caches use the appropriate variant key. In HTTP/2 and HTTP/3, the :status pseudo-header field carries the numeric HTTP status code, like 200, and must appear first in the header block before regular fields, replacing the status line from HTTP/1.1.[41][42] For HTTP/3, basic stream dependencies and prioritization are handled at the QUIC transport layer, with extensible prioritization supported via the dedicated Priority HTTP header field per RFC 9218 to signal client preferences.[43][44] The Alt-Svc field advertises alternative service endpoints, such as "h2=:443", allowing clients to connect to different hosts or protocols for the same origin, as defined in RFC 7838.[45] The NEL (Network Error Logging) field configures reporting of network errors for the origin, specifying a policy with report URI and maximum age, enabling developers to collect client-side error data.[40][46] The Warning header, part of HTTP/1.1 semantics, conveyed cautionary information about response freshness or transformations, such as "110 localhost:8080 'Response is stale'" for cache warnings. However, it is deprecated in HTTP/2 and later versions per RFC 9111, where header compression and binary framing make its variable-length text inefficient, leading to rare usage in contemporary deployments.[47] X-Content-Type-Options, introduced by Microsoft in Internet Explorer 8 but now a permanent IANA-registered standard field, instructs browsers to strictly honor the Content-Type header without performing MIME type sniffing, using the value "nosniff" to prevent misinterpretation of content that could lead to security exploits like executing scripts from non-script resources. Initially IE-specific, it has been adopted by other browsers including Chrome and Firefox to mitigate MIME-based attacks, though it applies primarily to script and style resources.[48][40] X-Frame-Options, originating from browser vendors to prevent UI redress attacks but now a permanent IANA-registered standard field as specified in RFC 7034, addressed clickjacking by controlling whether a page could be framed, with directives like "DENY" to block all framing or "SAMEORIGIN" to allow only same-origin embeds. It is transitioning to the more flexible frame-ancestors directive in CSP, with older values like ALLOW-FROM now ignored by modern browsers.[49][40]Common Non-Standard Response Fields
Non-standard HTTP response headers, often introduced by browsers, web servers, or frameworks, have filled gaps in the core protocol specifications, providing additional functionality for security, debugging, and content handling. These headers, prefixed with "X-" or otherwise non-RFC-defined, gained widespread adoption before or alongside formal standardization efforts, but many face deprecation as HTTP evolves toward versions like HTTP/2 and HTTP/3, which prioritize efficiency and modern security models. While they enhance server responses in specific scenarios, their non-standard nature can lead to interoperability issues, prompting transitions to standardized alternatives. The X-Powered-By header discloses the software or framework generating the response, such as "PHP/8.0.0" or "Express," originating from early web server implementations like Apache and IIS to aid debugging. This practice poses a security risk by revealing the technology stack, enabling attackers to target known vulnerabilities in specific versions, as highlighted in security guidelines recommending its removal to minimize information disclosure.[48] Content-MD5, which provided a Base64-encoded MD5 checksum of the response body for integrity verification, was defined in early HTTP/1.1 but obsoleted in RFC 7231 due to inconsistent implementations across partial content and proxies, rendering it unreliable for modern use.[50] Servers and clients are advised against generating or relying on it, as it no longer aligns with HTTP's semantics for message integrity. Report-To enabled servers to specify endpoints for browser-generated reports on violations like Content Security Policy (CSP) infractions, using JSON objects to define named endpoint groups such as {"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"https://example.com/csp-reports"}]} . As part of the W3C Reporting API, it served as an experimental mechanism for error reporting but has been deprecated in favor of the standardized Reporting-Endpoints header, with limited production support due to its non-standard status. X-XSS-Protection activated built-in XSS filters in browsers like Chrome and IE, with values such as "1; mode=block" to detect and block reflected XSS attempts by scanning content before rendering. Google removed support in Chrome starting with version 72 in February 2019, following Microsoft's Edge removal in 2018, deeming it obsolete and potentially harmful due to false positives; CSP is now the preferred defense.[51]Specialized Fields
Security and Privacy Fields
Security and privacy fields in HTTP headers provide mechanisms to enforce secure connections, mitigate content injection attacks, control feature access, and limit information leakage, enhancing overall web application protection. These headers are typically set in responses but can influence both client and server behaviors, often integrating with underlying transport protocols like TLS. They address vulnerabilities such as man-in-the-middle attacks, cross-site scripting (XSS), and unauthorized data sharing, with specifications evolving through standards bodies like the IETF and W3C.[52][53] Strict-Transport-Security (HSTS), defined in RFC 6797, instructs browsers to interact with a site only over HTTPS, preventing protocol downgrade attacks and cookie hijacking on insecure connections.[52] The header includes amax-age directive specifying the duration in seconds for which the policy applies, along with optional includeSubDomains to extend protection to subdomains and preload to enable site inclusion in browser preload lists for broader enforcement.[52] For example, Strict-Transport-Security: max-age=31536000; includeSubDomains; preload enforces HTTPS for a year across subdomains and signals eligibility for preloading.[52]
Content-Security-Policy (CSP), standardized in levels 1 through 3 by the W3C, allows developers to declare approved sources for content loading, reducing risks from XSS and other injection vulnerabilities by restricting inline scripts, styles, and external resources.[53] Level 1 (2012) introduced basic directives like default-src, while Level 2 (2016) added reporting and nonce support, and Level 3 (ongoing) enhances nonce reuse and frame-ancestor controls.[54][53] A key directive, script-src, specifies allowed script sources, such as Content-Security-Policy: script-src 'self' [https](/page/HTTPS)://[example.com](/page/Example.com);, permitting scripts only from the same origin or a trusted domain.[53]
Permissions-Policy, the successor to the deprecated Feature-Policy header as per W3C specifications, enables granular control over browser features like geolocation, camera, and fullscreen access, preventing unauthorized use in iframes or subresources.[55] Introduced in 2020, it uses a serialized policy string to allow or disable features, e.g., Permissions-Policy: geolocation=(self "https://example.com"), restricting geolocation to the same origin and a specific domain.[55] Recent working drafts from 2024 introduce finer-grained controls, including container policies for nested browsing contexts and integration with emerging privacy features.[55]
Referrer-Policy controls the amount of referrer information sent in the Referer header during navigations and resource fetches, mitigating privacy leaks from URL exposure.[56] Specified by the W3C in 2017, it supports values like no-referrer (no referrer sent), same-origin (referrer only for same-origin requests), or strict-origin-when-cross-origin (origin-only for cross-origin with upgrades to HTTPS).[56] For instance, Referrer-Policy: strict-origin-when-cross-origin balances functionality and privacy by omitting paths and queries on cross-origin requests unless secure.[56]
Sec-GPC (Global Privacy Control), outlined in a 2022 W3C draft, signals user opt-out preferences for data sales or sharing across sites via a simple HTTP request header, promoting compliance with privacy laws like CCPA.[57] Browsers supporting GPC set Sec-GPC: 1 in requests when the user has enabled the control, allowing servers to honor do-not-sell/share directives without per-site configuration.[57]
Cross-Origin-Embedder-Policy (COEP), standardized in the HTML specification following its proposal by the WICG in 2020, enforces cross-origin isolation by requiring embedded resources to opt-in via CORS or CORP headers, enabling access to high-security APIs like SharedArrayBuffer while blocking unsafe embeddings.[58] Values include require-corp (mandating Cross-Origin-Resource-Policy) or credentialless (allowing anonymous fetches), as in Cross-Origin-Embedder-Policy: require-corp, which prevents Spectre-like attacks by isolating origins.[58]
Cross-Origin-Opener-Policy (COOP), standardized in the HTML specification following its proposal by the WICG in 2020, controls the relationship between a document and its opener or popups to enforce cross-origin isolation, mitigating side-channel attacks like Spectre by managing browsing context groups and restricting cross-origin window access.[59] Values include unsafe-none (default, allows shared context), same-origin-allow-popups (isolates except for same-origin popups), and same-origin (full isolation), as in Cross-Origin-Opener-Policy: same-origin-allow-popups, which permits popup creation while isolating the context for security.[59] It is often used alongside COEP for complete cross-origin isolation.
In HTTP/2 and HTTP/3, no dedicated security pseudo-headers exist beyond standard framing, but security integrates deeply with TLS; HTTP/3, per RFC 9114, mandates QUIC's built-in TLS 1.3 encryption for all connections, eliminating unencrypted options and enhancing privacy through integrated crypto handshakes.[60][61]
Caching and Performance Fields
Caching and performance fields in HTTP headers enable efficient resource management by controlling how responses are stored, transmitted, and retrieved, thereby reducing latency and bandwidth usage across client-server interactions. These headers address key aspects of web performance, including client-side caching strategies to minimize redundant requests and server-side optimizations like content encoding and protocol negotiations to streamline data transfer. By specifying directives for cache validity, freshness, and invalidation, they help balance data freshness with performance gains, while compression and encoding mechanisms further enhance throughput, particularly in modern protocols like HTTP/2 and HTTP/3. The Cache-Control header provides fine-grained control over caching behaviors through various directives. For instance, themax-age directive specifies the maximum age in seconds for a cached response before it must be revalidated, allowing clients to reuse fresh content without contacting the origin server. In contrast, no-store instructs caches to avoid storing the response at all, ensuring sensitive data is not persisted. These directives apply to both requests and responses, promoting efficient caching hierarchies from private browsers to shared proxies. Legacy compatibility is maintained via the Pragma header, where no-cache serves as a deprecated equivalent to Cache-Control's no-cache, signaling that caches must validate responses before use, though it lacks the precision of modern directives.
Performance-oriented headers facilitate optimized transmission and protocol enhancements. The Transfer-Encoding header, commonly set to chunked, allows servers to send response bodies in sequential chunks without specifying the total length upfront, which is essential for dynamic content generation and persistent connections. Complementing this, the TE header enables clients to indicate acceptance of trailers—metadata appended after the body—and specific transfer codings like compression, supporting trailers for checksums or late metadata. For protocol upgrades, the Alt-Svc (Alternative Services) header advertises alternative server endpoints or protocols, such as shifting to HTTP/2 over the same port, enabling seamless performance improvements without altering the primary URL.
In HTTP/2 and beyond, header compression plays a pivotal role in performance by mitigating overhead from repeated field transmissions. HPACK, the compression algorithm for HTTP/2, employs a static and dynamic table to encode headers efficiently, reducing redundancy in header blocks and achieving up to 50% size savings in typical scenarios. HTTP/3 extends this with QPACK, which adapts HPACK for QUIC's multiplexed streams by separating encoding and decoding to avoid head-of-line blocking, further optimizing for lossy networks. The Vary header interacts with caching by listing request headers (e.g., Accept-Encoding) that influence response variations, ensuring caches select the appropriate stored variant and preventing cache poisoning.
Recent advancements include support for early data transmission to enhance connection resumption. The Early-Data header, defined in RFC 8470 for HTTP over QUIC and TLS 1.3's 0-RTT (zero round-trip time) resumption, allows clients to send request payloads immediately upon connection resumption without waiting for server acknowledgment, reducing latency for repeated sessions by up to one full round-trip. In HTTP/3, server-push mechanisms are constrained by the MAX_PUSH_ID frame sent by the client on the control stream, which sets the maximum push ID and thereby limits the number of pushes to prevent resource exhaustion. These fields collectively address performance bottlenecks in evolving web architectures.