Common http request headers

1)Accept

Accept: application/json The browser can accept the type of postback from the server as application/json.
Accept: / Represents that the browser can handle all types, (generally, the browser sends this to the server).

2)Accept-Encoding

Accept-Encoding: gzip, deflate The browser declares the encoding method it accepts, usually specifies the compression method, whether it supports compression, and what compression method (gzip, deflate) it supports, (note: this is not just character encoding).

3)Accept-Language

Accept-Language:zh-CN,zh;q=0.9 The browser declares the language it accepts.

4)Connection

Connection: keep-alive When a webpage is opened, the TCP connection used to transmit HTTP data between the client and the server will not be closed. If the client visits the webpage on this server again, it will continue to use this established connection .
Connection: close means that after a Request is completed, the TCP connection used to transmit HTTP data between the client and the server will be closed. When the client sends the Request again, the TCP connection needs to be re-established.

5) Host (this header field is required when sending a request)

Host:www.baidu.com The request header field is mainly used to specify the Internet host and port number of the requested resource, which is usually extracted from the HTTP URL.

6) Refer

Referer: https://www.baidu.com/?start=1 When the browser sends a request to the web server, it will usually bring the Referer and tell the server which page I am linking from, and the server can get some Information is used for processing.

7)User-Agent

User-Agent: Mozilla/…, tell the HTTP server the name and version of the operating system and browser used by the client.

8)Cache-Control

Cache-Control:private is private by default. The response can only be used as a private cache and cannot
be shared between users. Cache-Control:public response will be cached and shared among multiple users. Normally, if HTTP authentication is required, the response will be automatically set to private.
Cache-Control:must-revalidate The response will be reused under certain conditions to satisfy subsequent requests, but it must go to the server to verify whether it is still is up to date.
Cache-Control: no-cache The response will not be cached, but will request resources from the server in real time.
Cache-Control:max-age=10 Set the maximum effective time of the cache, but this parameter defines the time size (for example: 60) rather than a certain time point. The unit is [seconds].
Cache-Control: no-store Under any conditions, the response will not be cached and will not be written to the client's disk. This is also used for some sensitive responses based on security considerations.

9)Cookie

Cookies are used to store some user information so that the server can identify the user's identity (it is more common on most websites that require login), for example, cookies will store some user names and passwords, and when the user logs in, a Cookies are used to store relevant information, so that the browser will determine that you are a legitimate user after reading the cookie information to verify on the server and allow you to view the corresponding webpage. Of course, the data in the cookie is not limited to the above range, and there are many other information that can be stored in the cookie, such as sessionid and so on.

10) Range (for resuming uploads)

Range:bytes=0-5 specifies the position of the first byte and the position of the last byte. Used to tell the server which part of the object it wants to fetch.

Guess you like

Origin blog.csdn.net/qq_44482048/article/details/129859252