List_of_HTTP_headers

List of HTTP header fields

List of HTTP header fields

Add article description


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), the age (the time it has resided in a shared cache) of the document being downloaded, amongst others.

General format

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

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

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

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

Standard request fields

More information Name, Description ...

Common non-standard request fields

More information Field name, Description ...

Response fields

Standard response fields

More information Field name, Description ...

Common non-standard response fields

More information Field name, Description ...

Effects of selected fields

Avoiding caching

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.[76] The behavior of Pragma: no-cache in a response is implementation specific. While some user agents do pay attention to this field in responses,[77] the HTTP/1.1 RFC specifically warns against relying on this behavior.

See also


References

  1. Peon, R.; Ruellan, H. (May 2015). "HPACK: Header Compression for HTTP/2". IETF. doi:10.17487/RFC7541. Retrieved December 13, 2021. {{cite journal}}: Cite journal requires |journal= (help)
  2. Internet Engineering Task Force (June 1, 2012). "RFC 6648". doi:10.17487/RFC6648. Retrieved November 12, 2012. {{cite journal}}: Cite journal requires |journal= (help)
  3. "Message Headers". Iana.org. June 11, 2014. Retrieved June 12, 2014.
  4. "core - Apache HTTP Server". Httpd.apache.org. Archived from the original on May 9, 2012. Retrieved March 13, 2012.
  5. "Cross-Origin Resource Sharing". Retrieved July 24, 2017.
  6. Petersson, A.; Nilsson, M. (June 2014). "Forwarded HTTP Extension: Introduction". IETF. doi:10.17487/RFC7239. Retrieved January 7, 2016. {{cite journal}}: Cite journal requires |journal= (help)
  7. "Message Headers". www.iana.org. Retrieved November 26, 2018.
  8. "Upgrade Insecure Requests - W3C Candidate Recommendation". W3C. October 8, 2015. Retrieved January 14, 2016.
  9. Amos Jeffries (July 2, 2010). "SquidFaq/ConfiguringSquid - Squid Web Proxy Wiki". Retrieved September 10, 2009.
  10. The Apache Software Foundation. "mod_proxy - Apache HTTP Server Version 2.2". Retrieved November 12, 2014.
  11. Dave Steinberg (April 10, 2007). "How do I adjust my SSL site to work with GeekISP's loadbalancer?". Retrieved September 30, 2010.
  12. "ATT Device ID". Archived from the original on February 16, 2012. Retrieved January 14, 2012.
  13. "WAP Profile". Retrieved January 14, 2012.
  14. de Boyne Pollard, Jonathan (2007). "The Proxy-Connection: header is a mistake in how some web browsers use HTTP". Retrieved January 16, 2018.
  15. Craig Timberg. "Verizon, AT&T tracking their users with 'supercookies'". The Washington Post. Retrieved January 19, 2014.
  16. "Django Cross Site Request Forgery protection". Django (web framework). Archived from the original on January 20, 2015. Retrieved January 20, 2015.
  17. "HTTP Request IDs". devcenter.heroku.com. Retrieved March 22, 2022.
  18. "The Value of Correlation IDs". Rapid7 Blog. December 23, 2016. Retrieved April 13, 2018.
  19. Hilton, Peter. "Correlation IDs for microservices architectures - Peter Hilton". hilton.org.uk. Retrieved April 13, 2018.
  20. "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.
  21. MDN contributors (March 3, 2023). "Sec-GPC". MDN Web Docs. Retrieved March 12, 2023.
  22. Dusseault, L.; Snell, J. (2010). "RFC 5789". doi:10.17487/RFC5789. S2CID 42062521. Retrieved December 24, 2014. {{cite journal}}: Cite journal requires |journal= (help)
  23. Nottingham, M.; McManus, P.; Reschke, J. (April 2016). "HTTP Alternative Services". IETF. doi:10.17487/RFC7838. Retrieved April 19, 2016. {{cite journal}}: Cite journal requires |journal= (help)
  24. Nottingham, M.; McManus, P.; Reschke, J. (April 2016). "HTTP Alternative Services, section 3". IETF. doi:10.17487/RFC7838. Retrieved June 8, 2017. {{cite journal}}: Cite journal requires |journal= (help)
  25. Reschke, J. (2011). "RFC 6266". doi:10.17487/RFC6266. Retrieved March 13, 2015. {{cite journal}}: Cite journal requires |journal= (help)
  26. "Public Key Pinning Extension for HTTP". IETF. Retrieved April 17, 2015.
  27. Ross, D.; Gondrom, T. (2013). "HTTP Header Field X-Frame-Options". IETF. doi:10.17487/RFC7034. Retrieved June 12, 2014. {{cite journal}}: Cite journal requires |journal= (help)
  28. "Content Security Policy Level 2". Retrieved August 2, 2014.
  29. "Content Security Policy". W3C. 2012. Retrieved April 28, 2017.
  30. "Expect-CT". Mozilla Developer Network. Retrieved July 23, 2021.
  31. "NEL". Mozilla Developer Network. 2021. Retrieved May 18, 2021.
  32. "Permissions Policy". W3C. 2020. Retrieved May 1, 2021.
  33. "Am I FLoCed?". EFF. 2021. Retrieved May 1, 2021.
  34. "CSP: report-to". Mozilla Developer Network. 2021. Retrieved May 18, 2021.
  35. RFC 9110: HTTP Semantics
  36. "Timing-Allow-Origin". Mozilla Developer Network. Retrieved January 25, 2018.
  37. "Configuring servers for Ogg media". May 26, 2014. Retrieved January 3, 2015.
  38. Eric Lawrence (September 3, 2008). "IE8 Security Part VI: Beta 2 Update". Retrieved September 28, 2010.
  39. van Kesteren, Anne (August 26, 2016). "Fetch standard". WHATWG. Archived from the original on August 26, 2016. Retrieved August 26, 2016.
  40. "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".
  41. Eric Lawrence (July 2, 2008). "IE8 Security Part IV: The XSS Filter". Retrieved September 30, 2010.
  42. "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.

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.


    Share this article:

    This article uses material from the Wikipedia article List_of_HTTP_headers, and is written by contributors. Text is available under a CC BY-SA 4.0 International License; additional terms may apply. Images, videos and audio are available under their respective licenses.