HTTP ETag

ETag ( entity tag for such Entitätmarke ) is a well-established in the HTTP 1.1 header field. It is used to determine changes to the requested resource and is mainly used for caching, thus avoiding redundant data transmissions can be used.

Specification

The ETag value is an arbitrary string enclosed in quotation marks, which can also be identified by the prefix "W / " as a weak ETag. The BNF specifying this:

ETag = " ETag " ": " entity- tag entity- tag = [ weak ] opaque - tag weak = " W / " opaque - tag = quoted-string Strong ETag A strong ETag may only be performed by multiple entities of a resource if they are absolutely identical ( bit by bit ). Weak ETag A weak ETag ( by " W / " prefix in ) may be performed by multiple entities of a resource if they are equivalent to each other, So semantically do not differ significantly. Often based generating the ETag value on the system-specific inode, size and the date of last modification of a file.

Expiration

At the first request of a resource, the server sends a specific for this resource ETag value in the ETag header field, which is stored locally by the client along with the resource. (Fig. 1) With a further request the same resource, the client sends in the header field If-None -Match with the previously saved ETag value. (Fig. 2) On the server side, the transmitted ETag value is then compared with the current and answered in accordance with the status code 304. (Fig. 3) The data for the resource are not sent in this case and the client uses the locally stored data.

Problems

In a clumsy implementation, the ETag can negatively impact: If the ETag is generated from the inode of the document to be delivered, this value is only valid on this system. If the document is now delivered from multiple servers (eg for server load balancing ), it can be processed a renewed request by the client of another server with a different ETag value, which in turn transfer the same file despite According ETags. For this reason, it is recommended that the inode is not to be used when generating the ETag value. For the generation of ETags a hash over the contents of the file or version number of the file for example, can alternatively be used.

In addition, users can be identified by ETag when a web server generates client- individual ETags.

401266
de