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

HTTP caches can cache logged-in variant of dashboard pages #92

Closed
simonw opened this issue May 10, 2021 · 3 comments
Closed

HTTP caches can cache logged-in variant of dashboard pages #92

simonw opened this issue May 10, 2021 · 3 comments
Labels
bug Something isn't working security

Comments

@simonw
Copy link
Owner

simonw commented May 10, 2021

This happened to me with https://simonwillison.net/dashboard/tag-word-cloud/ - I created it while signed in, then when I viewed it in a signed-out browser window I saw this:

Tag_word_cloud

Cloudflare had cached the variant of the page seen by me when I was signed in.

@simonw simonw added bug Something isn't working security labels May 10, 2021
@simonw
Copy link
Owner Author

simonw commented May 10, 2021

I think the best fix here is to serve cache-control: private on any dashboard pages that are served to signed-in users.

@simonw
Copy link
Owner Author

simonw commented May 10, 2021

I'm going to use django.utils.cache.add_never_cache_headers(response): https://github.com/django/django/blob/3.2.2/django/utils/cache.py#L270-L275

@simonw
Copy link
Owner Author

simonw commented May 10, 2021

Actually I have cache-control: private logic already, but it's overly-complex - and it misses the case where the user is signed in and hence seeing a custom version of the page.

I'm going to simplify the logic: if the user is logged in, the page doesn't get cached.

@simonw simonw closed this as completed in e6e36d2 May 10, 2021
simonw added a commit to simonw/simonwillisonblog that referenced this issue May 10, 2021
simonw added a commit that referenced this issue May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working security
Projects
None yet
Development

No branches or pull requests

1 participant