Systems & Backend

ETag

also: entity tag

A fingerprint of a resource’s content that lets the browser ask “changed since this version?” and skip re-downloading.

An ETag (entity tag) is a hash or version identifier a server attaches to a response representing that exact content. On the next request the browser sends it back (If-None-Match); if the content is unchanged, the server replies 304 Not Modified with no body, and the browser reuses its cached copy — saving bandwidth.

Worked example: a browser cached a response with ETag "v7"; it later sends If-None-Match: "v7", and the unchanged server returns a tiny 304 instead of re-sending the whole payload. Gotcha: ETags also enable optimistic concurrency for APIs — a client sends If-Match on an update, and the server rejects it (412 Precondition Failed) if the resource changed meanwhile — preventing lost updates; but poorly-generated ETags (e.g. including a timestamp that always changes) defeat caching entirely.