edit-icon download-icon

Status code 304 in logs

Last Updated: May 16, 2017

When a client successfully sends a request to the server for the first time, the server will return the correct content to the client, along with status code 200, last-modified header indicating the content modification time, and an ETag used for content change validation. When the same client requests to access the same file again, the server will determine whether the file is modified during the period between the two requests based on the ETag and last-modified header in the second request. If the file is not modified, the server returns status code 304 to notify the client that it can directly load the Web cached content. If the file is modified, the server returns the most up-to-date version of the file to the client, along with the ETag and last-modified header for this version.

In the following instance, when a client successfully sends a request for an image, the server returns status code 200 and a response packet with headers such as ETag and last-modified.

1.JPG

When the client accesses the image again, it sends a request carrying the ETag and last-modified header of the previously accessed copy. See the figure below. The server determines whether the image is modified based on the ETag and last-modified header. If the image is not modified, the server returns status code 304. If the image is modified, the server returns the most up-to-date version of the image along with status code 200 to the client.

2.JPG

Therefore, a server log, Alibaba Cloud CDN log, or OSS log may contain status code 304, indicating that the Web cached content is hit and is not modified during a specified period. If you need to update the Web cache, press Ctrl+F5. Then the client clears the local Web cache before sending a request to the server. The server will return the desired content along with status code 200.

If the problem persists, contact Alibaba Cloud After-Sales Technical Support.

Thank you! We've received your feedback.