If the ETags differ, this is the sign for the client that the resource has been updated, and the client needs to download a new version, which is then made available to you. Only if both ETags are identical the cached resource may be made available to you. In doing so, the client compares the ETag of the cached resource with that of the server. When you revisit a website with a no-cache directive, a detour is returned to the server each time. As soon as the resource is updated, the token on the origin server is also changed. An ETag header is usually used for this purpose.Īn ETag is an HTTP header containing a unique token for the resource version at the time of the request. No-cache means that the cached resources cannot be re-used without first checking if the resource has changed or has an updated version on the origin server. The following is a list of the common directives used and configured using the Cache-Control header. You can configure your server to append the Cache-Control header to the response by specifying which directives to use. The Cache-Control header can appear in both HTTP responses and HTTP requests. For example, a request header informs what resource is being requested and what data formats the client accepts, while the response header tells whether the request was successfully fulfilled. HTTP headers are pieces of code central to browser requests and server responses when rendering websites and contain important information about each message. Hypertext Transfer Protocol (HTTP), the protocol on which web communications are based, was introduced in 1991 to enable data transfer between users and servers. HTTP headers allow the browser and the web server to communicate additional information to each other, such as the TTL for a resource. Once the TTL expires and you request the cached resource, the browser must reaccess the server and download a new copy of the resource. Thus, caching has a validity period, referred to as Time To Live (TTL). It is essential to understand that the browser always stores the respective resources only for a certain time. Accessing the copied resources is much faster because the browser doesn't have to request the server to get the same files each time. When you revisit the website, you can use Cache-Control to define rules that determine whether the data and images should be loaded from the local cache or whether your browser must send another request to the server to re-request the resources. When you visit a website, your browser stores copies of the accessed data and images in a store named the cache for faster access. Cache-Control is an HTTP cache header consisting of a set of directives that allow you to specify when/how to cache a response and for how long.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |