A web client (a browser) requests a resource from a web server.
Multiple calls for a resource would hit the server everytime and
server sends the response with return code 200.
What if the requested data is unchanged for most of the calls? Could the client somehow help server with the previous value of the requested resource?
- The purpose of ETag is to Save bandwidth and utilize client side caching.
- The client gets a hash of content for the first time request of a resource.
- The next call from the client has the ETag=Received hash value.
- Server checks if the value of the requested respurce has modified. So it recalculates the hash and compares it against the received hash.
- If Etag is same, server returns 304.
Written with StackEdit.