🔗 HTTP / HTTP Messages


HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.

Headers can be grouped according to their contexts:

  • Request headers: Contain more information about the resource to be fetched, or about the client requesting the resource.
  • Response headers: Hold additional information about the response, like its location or about the server providing it.
  • Representation headers: Contain information about the body of the resource, like its MIME type, or encoding/compression applied.
  • Payload headers: Contain representation-independent information about payload data, including content length and the encoding used for transport.

Most common headers

Тут приведены только наиболее часто встречающиеся мне заголовки. Полный список см. на MDN.

Authentication

  • Authorization: Contains the credentials to authenticate a user-agent with a server.

Caching

Conditionals

  • ETag: A unique string identifying the version of the resource. Conditional requests using If-Matchand If-None-Match use this value to change the behavior of the request.

Connection management

  • Connection: Controls whether the network connection stays open after the current transaction finishes.
  • Keep-Alive: Controls how long a persistent connection should stay open.

Content negotiation

  • Accept: Informs the server about the types of data that can be sent back.

Controls

Cookies

CORS

Downloads

  • Content-Disposition: Indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “Save As” dialog.

Message body information

Proxies

Redirects

  • Location: Indicates the URL to redirect a page to.

Request context

  • Referer: The address of the previous web page from which a link to the currently requested page was followed.
  • Referrer-Policy: Governs which referrer information sent in the Referer header should be included with requests made.
  • User-Agent: Contains a characteristic string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent.

Response context

  • Allow: Lists the set of HTTP request methods supported by a resource.
  • Server: Contains information about the software used by the origin server to handle the request.

Range requests

Security


References


📂 HTTP | Последнее изменение: 14.05.2024 21:52