ETag Verification
Background
An entity tag (ETag) of a URL is used to indicate whether the URL object is changed.
After a domain name is connected to CDN for acceleration, when a user request content for the first time, CDN PoPs pull content from the origin server, return content to the user, and cache the content to CDN PoPs. Within the configured cache TTL, when a user requests the content again, CDN does not need to pull content from the origin server. It returns the cached content to the user. When the content cached on CDN PoPs expires and a user requests the content:
- If ETag verification is enabled, CDN verifies the ETag value. If the values of ETag, Last-Modified, and Content-Length do not change, CDN returns the cached content to the user, reducing the origin pull ratio and relieving the pressure on the origin server. If the value of ETag, Last-Modified, or Content-Length changes, CDN pulls content from the origin server.
- If ETag verification is disabled, CDN does not verify the ETag value. If the values of Last-Modified and Content-Length do not change, CDN returns the cached content to the user. If the value of Last-Modified or Content-Length changes, CDN pulls the resource from the origin server.
Precautions
- By default, ETag verification is enabled.
- If range requests are enabled for an acceleration domain name, when the Last-Modified values of different segments of an origin resource pulled by CDN PoPs are different, CDN determines that the resource has changed. To avoid returning incorrect resources to clients, CDN interrupts the connection and client access. If similar problems occur, take the following measures:
- Disable range requests.
- If resource segments are stored on different origin servers, move them to the same origin server.
- Submit a service ticket to disable the verification of the Last-Modified value during origin pull.
- If the service type of your domain name is whole site acceleration, this function takes effect only for static resources.
Procedure
- Log in to Huawei Cloud console. Choose .
The CDN console is displayed.
- In the navigation pane, choose .
- In the domain list, click the target domain name or click Configure in the Operation column.
- Click the Origin Settings tab.
- Configure ETag Verification as required.
Figure 1 ETag verification
Examples
Assume that you have enabled ETag verification for domain name www.example.com.
After the cache of a resource under the domain name expires, when a user requests the resource, CDN verifies the ETag. If the ETag value remains unchanged, CDN directly returns the cached resource to the user and recalculates the cache expiration time. If the ETag value changes, CDN pulls the latest resource from the origin server, returns it to the user, and caches the resource.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.