When adding an ETag to an HTTP response, should I include the media type? Of course, I understand that the ETag is opaque, but here is an example:
Clearly it is incorrect to simply return a 304, but my question is, in the second request, would I expect the ETags to match but no cache based on the Accept header (or the content header). Also, is it even possible that the cache will have two representations from the same URI, or would you always have an invalid cache every time your Content-Type switched?
An ETag (entity tag) is an HTTP header that is used to validate that the client (such as a mobile device) has the most recent version of a record. When a GET request is made, the ETag is returned as a response header. The ETag also allows the client to make conditional requests.
An entity tag (ETag) is an HTTP header used for Web cache validation and conditional requests from browsers for resources. Etags use persistent identification elements (PIE) that have been tagged to the user's browser.
The standard says that one must use a "strong validator" for handling ETag: thus, ETags must be treated as opaque values and matched accordingly (i.e. case sensitive).
Different representations need different entity tags.
See http://trac.tools.ietf.org/wg/httpbis/trac/ticket/39.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With