HTTP header of HTTP message

Source: Internet
Author: User
Tags time and date

The first and the method work together to determine what the client and server can do.

Headers can be used to provide information in request and response messages, some headers are specific to a particular message, and some headers are more general. The first part can be a five main type.

    • Generic Header : These are common headers that both the client and server can use. can provide some very useful common functionality between the client, the server, and other applications. For example, the date header is a generic header that can be used at each end to describe the time and date the message was built.

    • Request Header : It can be seen from the name that the request message is unique to the request header. They provide some additional information to the server, such as what type of data the client wants to receive. For example, the following accept header is used to tell the server client that it will accept any media type that matches its request: Accept: */*

    • Response Headers : The response message has its own header set to provide information to the client (for example, what type of server the client interacts with). For example, the following server header is used to inform the client that it is interacting with a version 1.0 Tiki-hut server. server:tiki-hut/1.0

    • Entity Header: The entity header refers to the header that is used to respond to the body part of the entity. For example, you can use the entity header to describe the data type of the entity body part. For example, the application can be informed by the following Content-type header, the data is an HTML document in the iso-latin-1 character set: content-type:text/html; Charset=iso-latin-1

    • extension Header : The non-standard header at the extension header, created by the application developer but not yet added to the approved HTTP specification. Even if you do not know the meaning of these extension headers, the HTTP program accepts them and forwards them.

General Header

Some of the headers provide the most basic information related to the message, which is called the generic header.

First Describe
Connection Allow clients and servers to specify options related to request/response connections
Date Provides a date and time flag that describes when the message was created.
Mime-version Gives the MIME version used by the sending side
Trailer If the message uses a chunked transfer encoding (chunked transfer encoding), this header can be used to list the first set of the sterile message trailer (trailer) section.
Transfer-encoding Inform the receiving end to ensure the reliable transmission of the message, the use of the message encoding method
Update gives the new version or protocol that the sending side might want to "upgrade"
Via Shows the intermediary node (proxy, Gateway) of the message passing through

Universal Cache Header

Http/1.0 introduced the first header to allow the HTTP application to cache the local copy of the object so that it does not always have to be obtained directly from the source server. The latest HTTP version has a very rich set of cache parameters.

First Describe
Cache-control Used with message delivery cache indication
Pragma Another way of sending instructions with a message, but not dedicated to caching

Request Header

The header of the request is only meaningful in the request message. Used to describe who or what is sending a request, where the request originated, or the client's preferences and capabilities. The server can try to provide a better response to the client based on the client information given by the request header.

First Describe
Client-ip Provides the IP address of the machine running the client
From Provide e-mail addresses of various client users
Host gives the host name and port number of the server receiving the request
Referer Provides the URL of the document that contains the current request URI
Ua-color Provides information about the display color displayed by the client
Ua-cpu gives the type or manufacturer of the client CPU
Ua-disp Provides information about the capabilities of the client display (screen)
Ua-os The name and version of the operating system running on the client machine is given.
Ua-pixels Provides pixel information for the client display
User-agent Notifies the server of the application name that originated the request

Accept Header

The Accept header provides a way for clients to tell their preferences and capabilities to the server, including what they want, what they can use, and, most importantly, what they don't want. This allows the server to make more informed decisions about what to send, based on this additional information.

First Describe
Accept Tell the server which media types to send
Accept-charset Tell the server which character sets to send
Accept-encoding Tell the server which encoding to send
Accept-language Tell the server which languages to send
TE Tell the server which extended transfer encoding can be used

Conditional Request Header

Sometimes the client wants to add some restrictions to the request. For example, if the client already has a copy of the document, it wants the server to transfer the document only if the document on the server differs from the client-owned copy.

First Describe
Expect Allow clients to list the server behavior required by a request
If-match Gets this document if the entity tag matches the current entity tag of the document
If-modified-since Restrict this request unless the resource has been modified after a specified date
If-none-match Gets the document if the provided entity tag does not match the entity tag of the current document
If-range Allow conditional requests on a range of documents
If-unmodified-since Restrict this request unless the resource has not been modified after a specified date
Range If the server supports scope requests, the specified range of resources is requested

Security Request Header

HTTP itself supports a simple mechanism to challenge/respond to requests for authentication. This mechanism requires the client to authenticate itself before acquiring a specific resource, which can make things safer.

First Describe
Authorization Contains the data that the client provides to the server to authenticate itself
Cookies The client uses it to send a token to the server-it is not a true security header, but it does imply a security feature.
Cookie2 Used to describe the cookie version supported on the requester side.

Proxy request Header

With the ubiquitous use of proxies on the Internet, several headers have been defined to assist in their better work.

First Describe
Max-forward The maximum number of times a request is forwarded to another proxy or gateway on the path to the source-side server-in conjunction with the TRACE method
Proxy-authorization Same as Authorization header, but this header is used when authenticating with the agent
Proxy-connection Same as Connection header, but this header is used when establishing a connection to the agent

Response header

The response message has its own response header set. The response header provides some additional information to the client, such as who is sending the response, the function of the responder, and even some special instructions related to the response.

First Describe
Age Response Duration (starting from initial creation)
Public List of request methods that the server supports for its resources
Retry-after Retry on this date or time if the resource is not available
Server Name and version of the server application software
Title For an HTML document, it is the title given by the source side of the HTML document.
Warning Some of the more detailed warning messages than the reason phrases

Negotiation Header

If the resource has multiple representations-for example, if the server has a French and German translation of a document, http/1.1 can provide the server and client with the ability to negotiate resources.

First Describe
Accept-ranges For this resource, the types of scopes that the server can accept
Vary The list of other headers viewed by the server may cause the response to change; that is, this is a header list, and the server picks the most appropriate version of the resource to send to the client based on the contents of the header.

Security Response Header

We have seen the security request header, which is essentially the response side of the HTTP Challenge/response authentication mechanism. Now here are some basic questions about the header.

First Describe
Proxy-authenticate List of challenges from the agent to the client
Set-cookie is not a true security header, but has security features; You can set a token on the client so that the server identifies the client
Set-cookie2 Similar to Set-cookie, see section 11.6.7
Www-authenticate List of challenges to the client from the server

Entity Header

The entity header provides a large amount of information about the entity and its contents, from information about the object type to the various valid request methods that can be used on the resource. In summary, the entity header can tell the recipient of the message what it is dealing with.

First Describe
Allow Lists the request methods that can be performed on their entities
Location Tells the client entity where it is actually located; the (possibly new) location (URL) where the receiving end is directed to the resource

Content Header

The content header provides specific information about the entity's content, describes its type, size, and other useful information needed to process it. For example, a Web browser can learn how to display objects by looking at the type of content returned.

First Describe
Content-base Base URL to use when resolving relative URLs in the body
Content-encoding Arbitrary encoding of the subject itself
Content-language The most appropriate natural language for understanding the subject
Content-length Length or size of the body
Content-location Where the resource is actually located
Content-md5 MD5 Checksum of the subject
Content-range The byte range identified by this entity in the entire resource
Content-type The object type of this subject

Entity Cache Header

The generic cache header describes how or when to cache. The cache header of an entity provides information about the cached entity-for example, the information needed to verify that a cached copy of the resource is still valid, and a better way to estimate when the cached resource is invalidated.

First Describe
ETag Entity tags related to this entity
Expires Entity is no longer valid, to obtain the date and time of this entity from the original source side again
Last-modified The date and time that the entity was last modified


This article from "Professor elder brother" blog, reprint please contact the author!

HTTP header of HTTP message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.