The intermediate response code for pre-loading resources on the first screen, why is it only issued in multi-path multiplexing protocols in most cases?
The intermediate response code used for preloading resources on the first screen, and why it is sent only in most cases on multiplexing protocols, is due to compatibility and security concerns: under old protocols, the client's handling of multiple responses is not stable, and most browsers therefore limit support to protocol 2 or higher versions. This intermediate response itself solves the waiting time - while the server is preparing the page, it first tells the client 'which sources will be used later on'.
Which part of the waiting is solved by the intermediate response code?
In a first-screen loading, the time-consuming composition is not just the page itself: establishing a connection, negotiating encryption, retrieving styles and scripts, every step has to wait for the previous step. When the page is organized on the server side, the client is completely idle during this time. The role of this intermediate response is to make use of this gap: while the server is preparing the final response, it first returns a prompt indicating the source of the resources to be used later, the client can preconnect, or start preloading.
What kind of headers are usually placed in the prompt?
According to the document, this prompt is mainly used in conjunction with link headers, its semantics is to indicate the resources to be loaded; at the same time, it can also carry a Content Security Policy header that takes effect during the prompt processing stage. That is to say, it is not 'send the page out in advance', but to inform two types of information that can be determined without relying on the page content: the source address and the strategy. The actual content is still provided by the final response.
Why limit it to multiplexing protocols
The document gives the reason for compatibility and security, and explicitly recommends sending only on protocol 2 or higher versions unless it is known that the client can correctly handle intermediate responses;Most browsers also limit their support for this to protocol 2 and above. The difference lies in how the protocol handles a request corresponding to multiple responses. Multiplexing protocols naturally separate multiple responses on the same request into independent frames, and intermediate responses will not pollute the final response state.Under the old protocol, the client needs to split the two segments of response on the same connection, and this kind of split is most likely to cause problems in the historical implementation, even treating prompts as incomplete pages.The risk falls on the clients with the worst compatibility, while the benefit only manifests in the time spent on establishing a connection on the first screen.
Can the site layer be directly matched
To confirm three things: whether the program will generate intermediate responses, whether the front-end layer will discard them, and whether the protocol is a multiplexed version. The program side should be able to return a prompt before the page is organized, which usually depends on the framework or server module support. The front-end layer is the most common breakpoint: the caching, reverse proxy, and compression links may only pass through the final response, and the intermediate response is ignored during forwarding. The deployment of AnQiCMS is generally the front-end server proxying to the default listening port 8001, and it is necessary to verify the protocol version and forwarding behavior of each hop on this link, rather than just looking at the site's own configuration.
What situations should not rely on it
In three cases, the income is close to zero. When all resources are from the same source and there are no external domains, there is no time saved in pre-connection; when the final response itself can be returned in a very short time, the lead time of the prompt is not enough to complete a connection negotiation;When there are components on the chain that will consume intermediate responses, even if it is configured, there is no effect. Conversely, pages with a large number of third-party sources and high negotiation time are the real scenarios where this capability is truly applicable.The importance of page loading speed for content sites has an official statement, AnQiCMS says it has a significant improvement compared to traditional PHP programs, can carry about 5 million PV on a single machine, but this kind of intermediate response only solves a small part of the connection establishment on the first screen, and it cannot replace resource size and caching strategy.
Common questions
Question: What will happen if the client does not support this response code? Answer: According to the protocol, it will be ignored as an intermediate response, and the final response will still be returned normally; the risk lies in the processing differences under old protocols, which is why it is recommended to limit it to protocol 2 and above.
Question: How much can the first screen load time be saved after it is turned on? Answer: It depends on the number of connection negotiations to wait for originally, saving the time for connection establishment and negotiation, not the page generation time.
Question: If the prompt is seen in local testing but not online, what should be checked first? Answer: First check the forwarding behavior and protocol version of the front-end layer, and then confirm at which layer the program can issue the prompt.