Learn VisualLearn API

Validate by Timestamp Instead of by ETag

Last-Modified is a header in which the server tells the client when the resource last changed. To revalidate, the client sends that timestamp back in an If-Modified-Since header. If it hasn't changed, the server returns 304 Not Modified. This is the same flow and the same outcome as ETag validation with If-None-Match.

However, Last-Modified has a weakness: its precision only goes down to the second. For example, a version saved at 12:00:03.1 and a different version saved at 12:00:03.6 both get a Last-Modified of 12:00:03, so they can't be told apart.

An ETag doesn't have this weakness, because it is computed from the resource's actual content rather than a timestamp. Those same two versions get different ETags if their content differs.

So a server usually sends both headers on the same response. When a client has both, it prefers the stronger ETag.

GOAL

Trace a Last-Modified-based revalidation exchange, and explain when it's a weaker check than ETag.

Two different versions of the same resource are saved half a second apart. What happens to their Last-Modified timestamps?