This article is reprinted from the WeChat public account "JS Daily Question", the author is Huihui. Please contact the JS Daily Question public account to reprint this article. 1. What isHTTP header fields refer to the message header part in the request and response messages of the Hypertext Transfer Protocol (HTTP) They define the parameters of an operation within a HTTP transaction. HTTP header fields can be defined as needed, so non-standard header fields may be found on web servers and browsers. The following is a request header for an HTTP request:
2. ClassificationCommon request fields are shown in the following table:
3. Usage scenariosBy coordinating the request header and response header, the following functions can be implemented in some scenarios: Negotiation Cache Negotiation cache is managed using two pairs of request and response headers: [Last-Modified, If-Modified-Since] and [ETag, If-None-Match] Last-Modified indicates the date when the local file was last modified. The browser will add If-Modified-Since (the value of Last-Modified returned last time) to the request header to ask the server whether the resource has been updated after that date. If so, the new resource will be sent back. Etag is like a fingerprint. Any change in the resource will cause the ETag to change, regardless of the last modification time. ETag can ensure that each resource is unique. The If-None-Match header will send the Etag returned last time to the server, asking whether the Etag of the resource has been updated. If there is a change, a new resource will be sent back. Forced caching does not require sending requests to the server. It determines whether the strong cache is hit based on the request headers expires and cache-control. The flowchart of mandatory caching and negotiated caching is as follows: Session State Cookies are small text files that are stored on the user's local terminal by some websites in order to identify the user. They are determined by the response header set-cookie. As a small text data that generally does not exceed 4KB, it consists of a name (Name), a value (Value) and several other optional attributes used to control the validity period, security, and scope of use of the cookie. Cookies are mainly used in the following three aspects: Session state management (such as user login status, shopping cart, game scores, or other information that needs to be recorded) Personalization settings (such as user-defined settings, themes, etc.) Browser behavior tracking (such as tracking and analyzing user behavior, etc. References https://zh.wikipedia.org/wiki/HTTP header fields https://github.com/amandakelake/blog/issues/41 |
<<: What is the difference between a free SSL certificate and a paid one?
CloudSilk has launched a VPS host in Tokyo, Japan...
[[442701]] As we all know, spectrum resources are...
Introduction We analyzed the Go native network mo...
Digital-vm is a foreign VPS service provider esta...
CrownCloud, which I first shared information abou...
The article shows that the United States is incre...
[[377132]] 01 Introduction to Ethernet The Ethern...
In order to further unleash the role of new infra...
Friendhosting has launched a SysAdmin Day Sale pr...
4G changes life, 5G changes society. As the leade...
Today I will introduce the DNS access principle t...
800G optical modules have entered mass production...
After several twists and turns, China's three...
One of the most important exhibitions of the year...
[[436945]] Microsoft Teams users can now access a...