Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use etags #72

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Use etags #72

wants to merge 9 commits into from

Conversation

gwenya
Copy link
Contributor

@gwenya gwenya commented Jul 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant