As discussed in #69 this PR sets Etag headers on responses and returns a Not Modified response instead of the cached response if the client sent an If-None-Match header that matches the Etag of the cached response. The Etag is set with Django's set_response_etag() util, which just hashes the content of the response. If the response already has an etag then that is respected.
It also adjusts the Cache-Control header to either set no-cache or must-revalidate depending on whether the response has a max-age.
I am not sure yet what the Cache-Control and Expires headers on a Not Modified response should be set to.
As discussed in #69 this PR sets
Etag
headers on responses and returns aNot Modified
response instead of the cached response if the client sent anIf-None-Match
header that matches theEtag
of the cached response. The Etag is set with Django'sset_response_etag()
util, which just hashes the content of the response. If the response already has an etag then that is respected.It also adjusts the
Cache-Control
header to either setno-cache
ormust-revalidate
depending on whether the response has amax-age
.I am not sure yet what the
Cache-Control
andExpires
headers on aNot Modified
response should be set to.