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

Caches also saves data in the navbar #112

Open
Askancy opened this issue Apr 26, 2023 · 2 comments
Open

Caches also saves data in the navbar #112

Askancy opened this issue Apr 26, 2023 · 2 comments

Comments

@Askancy
Copy link

Askancy commented Apr 26, 2023

The caching system works properly, however, it happens that if caching is stored with me as the user, visitors who visit the page end up with my name as the logged-in user in the navbar.
How can I avoid having items cached that should only be seen by logged-in users?

@jonathonbyrdziak
Copy link

What you're trying to do is probably outside the scope of this caching extension at the moment. However, here's something you can do to begin accomplishing this:

Load your sensitive data through ajax.
This caching extension is only going to cache the response from specific controllers. so If you're using an ajax loading system to populate certain datasets, then the core of the page gets cached and your sensitive content is loaded via ajax (not a cached route)

@tvbeek
Copy link

tvbeek commented Oct 27, 2023

Personal I only use the middleware on public routes (that doesn't have any user information visible) If the current user is the only different part it can be an option to use the ajax way as described by @jonathonbyrdziak

Else I think it is more useful to cache parts of your response and not the whole page (but that is out of scope for this package).

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

No branches or pull requests

3 participants