ETag booster site to submit Sitemap — ETag introduction and role
I. introduction to ETag
An ETag(EntityTags) is a tag of a URL that indicates whether the URL object has been changed so that it can be cached by a client, such as a browser. The ETag is first generated by the server, and the client asks the server to validate its cache by passing the token back to the server. The server USES it to determine if the page has been modified and returns 304 if it has not been modified without retransferring the entire object.
Second, now the site Sitemap problems
- Found that the update was not timely
When the site or its Sitemap updates, baidu is difficult to timely find and respond, because baidu is difficult to constantly check the site content and whether Sitemap updates.
- Full capture consumes bandwidth
Now baidu site Sitemap crawl will Sitemap file download complete, in view of the Sitemap file is generally large, and this download may exist for many times, so compare the consumption of site traffic and bandwidth.
Iii. ETag function
HTTP1.1 USES ag to determine whether the requested file has been Modified, primarily to solve problems that last-modified cannot solve
- Some files may change periodically, but their contents do not change (only the modified time). At this time, the client is not expected to think that the file has been modified and GET again;
- Some files are Modified very frequently, N times within 1 second. The granularity of if-modified-since can be checked is in seconds, and such modification cannot be judged
- Some servers cannot accurately obtain the last modification time of the file;
To this end, HTTP1.1 introduces etags.however, the standard does not say what the content of an ETag is or how it should be implemented, only that the ETag needs to be in double quotes. The ETag is generated by the server side, and the client side verifies whether the resource is modified or not by judging the request based on the condition of if-match or if-none-match. We commonly use if-none-match. The process of requesting a file may be as follows:
- The client initiates an HTTP GET request for a file;
- The server processes the request and returns the file contents and a bunch of headers, including ETag(for example, “1ec5-502264e2ae4c0”)(assuming the server supports ETag generation and ETag has been started). The status code is 200, as shown in the figure below.
- The client initiates HTTP GET request for a file. At this time, the client sends an if-none-match header at the same time
- The server determines that the ETag sent and the ETag calculated are matched. Instead of returning 200, it returns 304, so that the client can continue to use the local cache. As shown in the figure, this time for bd_logo1.png, the server only returned headers and no content, with a size of only 349B.
Iv. Benefits of site enabling ETag
- After enabling ETag for Sitemap, baidu can respond to the update of Sitemap more quickly. Without changing the content, the server only sends back 304 reply headers, which consumes very little traffic.
- Now adsense platform for each site Sitemap actively fetching cap, and what the function does not open to all standing, if your site Sitemap enabled ETag, and passed the test, you can use a small flow enjoy baidu update your Sitemap function, so that baidu included the contents of your website better.