Search code examples
pythondjangoetag

Can somebody explain me what is the use of "etag" in django?


I am confused with the etag mechanism. If anyone could explain it, would be a big help


Solution

  • So first lets separate etags from django/python. The concept of etags, lives independently of any programming language. It is actually part of HTTP.

    Simply put etags are part of the way one might go about implementing a web cache. Basically the server returns an ETag header which is a hash that represents the state of a resource. The client can then send that hash value to the server which can perform a check, if it matches then the cache the client has is still valid 304. If the values are different then the server would send a full response back to the client.

    Basically outlined on Wiki :)