HTTP status code 304 means "not modified". Its main function is to optimize network transmission and reduce unnecessary data transmission and server burden. By using the caching mechanism, the client can avoid downloading the same resources repeatedly and improve efficiency. And response speed, it should be noted that when the server returns a 304 status code, the response will not contain the actual resource content, because the client should use the cached version.
# Operating system for this tutorial: Windows 10 system, Dell G3 computer.
HTTP status code 304 means "Not Modified".
When the client sends a conditional request, such as using the If-Modified-Since or If-None-Match field, to request a resource from the server, and the resource has not changed on the server , the server will return a 304 status code. This means that the client's cached copy is still valid and the cached version can continue to be used without re-downloading the resource.
The main function of the 304 status code is to optimize network transmission and reduce unnecessary data transmission and server burden. By using the caching mechanism, the client can avoid downloading the same resources repeatedly, improving efficiency and response speed.
Normally, the client will receive a 200 OK status code when requesting a resource for the first time, indicating that the server successfully returned the resource. The client will then cache the resource and include the corresponding condition fields in subsequent requests. When the server determines that the resource has not been modified, it will return a 304 status code to inform the client to use the cached version.
It should be noted that when the server returns a 304 status code, the response will not contain the actual resource content, because the client should use the cached version. If the client's cache has expired or is invalid, the complete resource needs to be requested again, and the server will return a 200 OK status code.
To summarize, HTTP status code 304 indicates that the requested resource has not been modified, and the client can continue to use the cached version without re-downloading.
The above is the detailed content of What is http status code 304?. For more information, please follow other related articles on the PHP Chinese website!