A | B | C | D | E | F | G | H | CH | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
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), 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
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 |
Permanent | 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?pojem=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
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
Must not be used with HTTP/2[14] |
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. | X-Request-ID: f058ebd6-02f7-4d3f-942e-904344e8cde5
|
Save-Data[45] | 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[46] | The Sec-GPC (Global Privacy Control) 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
Standard response fields
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[47] | 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[48] | 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. [49] |
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[50] | 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[51] | 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 | Zdroj:https://en.wikipedia.org?pojem=HTTP_response_header_field