authentik icon indicating copy to clipboard operation
authentik copied to clipboard

Why does the browser cache have to be cleared after every upgrade?

Open davidus05 opened this issue 2 years ago • 1 comments

Describe your question/ The users always have to clear the browser cache every time after authentik was upgraded. Otherwise, they see the spinner loading indefinitely or do not see the login box at all. For admins, the admin panel does not work correctly when cache is not cleared. There are lots of issues about that (for example, see: https://github.com/goauthentik/authentik/issues/3453).

Is there any way to improve that in the future?

Version and Deployment (please complete the following information):

  • authentik version: 2022.8.1 and before
  • Deployment: docker-compose

davidus05 avatar Aug 20 '22 16:08 davidus05

The browser cache shouldn't have to be cleared manually. authentik sets these headers on static files: https://github.com/goauthentik/authentik/blob/main/internal/web/static.go#L61

This indicates that whenever the X-authentik-version header changes (which it does after an upgrade), files should be freshly loaded instead of from the cache.

Cloudflare does not support the Vary header https://developers.cloudflare.com/cache/about/cache-control#other

The other way to solve this issue is to add a service worker to authentik, as thats the only way to client-side clear the browsers cache from the frontend

BeryJu avatar Aug 24 '22 11:08 BeryJu