ETag
A response header holding an opaque tag that names one exact version of a representation, such as ETag: "1".
In more detail
Clients send the tag back in If-None-Match to ask whether their copy is still current, or in If-Match to make an update conditional on the version they read. When the representation changes, the tag changes.
Examples
In the APIs course: The course fault that removes the ETag looks harmless but breaks both caching and safe updates.In the browser: The browser sends it back in If-None-Match; if nothing changed the server replies 304 Not Modified with no body.Related terms
- If-None-Match — The request header that sends back an ETag and asks the server to answer 304 Not Modified if that version is still current.
- If-Match — The request header that makes a write conditional: the server applies it only if the resource still has the ETag the client sends.
- cache validation — Asking the server whether a stored response is still current by sending back its validator, such as an ETag, in a conditional request.
- optimistic concurrency control — A way to prevent lost updates by reading a version, preparing a change, and making the write succeed only if that version is still current.
- conditional request — An HTTP request that the server carries out only if a condition in its headers is true, such as If-None-Match or If-Match.
- Cache-Control — The HTTP header that states the caching policy for a response, such as private, max-age=0 or no-store.
- HTTP cache — A store that keeps HTTP responses and reuses them for later requests, following the rules the server sends in Cache-Control.
- versioned key — A cache key that includes the data's version, so a write simply moves readers to a new key.
Taught in
- HTTP Methods And Status Codes — Modern API Architecture: REST, GraphQL & gRPC
- Caching And Conditional Requests — Modern API Architecture: REST, GraphQL & gRPC
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform
- IAM Policies, Inheritance And Deny — Google Cloud Associate Cloud Engineer Exam Prep
- Basic, Predefined And Custom Roles — Google Cloud Associate Cloud Engineer Exam Prep
- Cache Invalidation And The Three Hard Cases — Scalable System Design & Distributed Architecture