Closed hahn-kev closed 5 hours ago
The browser is simply pulling things out of its cache.
query projectChangesets
on the project page only happens client-side), no requests will hit either SvelteKit or the API, so we won't detect that the user isn't authenticated anymore.We clear the GQL cache and invalidate SvelteKit stuff (by simply doing a full page load), but we never clear the browser cache, because we can't.
So, I think the only bullet-proof way to handle this is to disable the browser cache (for relevant requests) e.g.:
response.headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
response.headers.set('Pragma', 'no-cache');
response.headers.set('Expires', '0');
Any other solution will have holes, but they might still be worth considering E.g.:
I wonder if we can just store something in memory and when they navigate back we should receive a navigate event which we can react to. But maybe that's over designing it.
Actually, I just found the right header to tell the browser to clear its cache: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data#browser_compatibility
I'm pretty sure it's exactly what we want
Describe the bug When you log out your local cache should be cleared and clicking back should not be able to take you to a page with sensitive data
To Reproduce
Expected behavior trying to go back should just redirect you back to the login page. Additionally we should figure out where the data is coming from that is being displayed when you go back as the cache should have also been cleared.