Help Center/ Content Delivery Network/ FAQs/ Troubleshooting/ Why Is 304 Returned When a User Accesses a Resource Under My Acceleration Domain Name?
Updated on 2023-03-29 GMT+08:00

Why Is 304 Returned When a User Accesses a Resource Under My Acceleration Domain Name?

Status code 304 indicates that the resource has not changed since the last time CDN cached it.

When a client requests the resource for the first time, CDN returns the resource in a 200 response to the client. The response includes ETag that marks the time when the resource was last modified. When the client requests the resource again, if the ETag value is not modified, 304 is returned and the client loads the cached content. If the ETag value differs, the modification time is marked and CDN returns the new resource to the client. Details are as follows:

  1. When a client accesses 1.jpg for the first time, CDN returns the image in a 200 response to the client. Response headers include Last-Modified (last modification time) and ETag.

  2. When the client accesses 1.jpg again, the request headers carry the Last-Modified and ETag values. If the two values differ, CDN returns the latest image in a 200 response to the client. If not modified, the client loads the cached content.

  3. The user can press Ctrl+F5 to clear the client cache. When the user accesses the resource again, status code 200 will be returned.