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?
Overview The performance issue of TCP is essentia...
Previously, we have shared the promotional inform...
spinservers is a site under Majestic Hosting Solu...
Optical fiber is an important part of communicati...
The "Economic Operation of the Communication...
With over 1.1 billion users, WeChat is China’s la...
dwidc (Dawang Data) is the site of Shaanxi Securi...
It’s clear that in the business world, digital op...
What is a bridge A bridge is like a smart repeate...
Recently, the promotional activities and efforts ...
Megalayer launched a Black Friday flash sale, whi...
The concept of the Internet of Things (IoT) has b...
At the 31st PT Expo held recently, 5G became the ...
[[393100]] 1. Introduction to HTTP Protocol HTTP ...
"Smart Park" is not a new concept. In t...