ETag & Last-Modified
Validation headers allow the client to say: "I have an old copy of this file. Has it changed?". This saves bandwidth by not downloading the same data twice.
Step 1 of 2
Worked example
Request
If-None-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"Response
HTTP/1.1 304 Not ModifiedA 304 response is tiny because it contains no body. It simply tells the browser "Your old copy is still perfect, keep using it".
ETag (Entity Tag)
An ETag is a unique fingerprint (hash) of a file. If the file content changes, the fingerprint changes.
The Validation Flow
1. Server sends file with ETag: "v1". 2. Browser saves file and ETag. 3. Next time, Browser sends If-None-Match: "v1". 4. Server compares ETags. If they match, it sends "304 Not Modified" (no body!).
Study kit
Module 10 of 18
Intermediate · 3 min · 0 of 18 complete
Module status
Not completed yet
Notessaved locally+
Notes stay in this browser. They are not uploaded.
Suggest an editLearning graph
Prerequisites
Discussion
Loading discussion…
Sign in to ask a question.