Allow to override keycloak resource tag for fixing issue with browser caching
See original GitHub issueDescription
Allow to modify resource tag from MigrationModelEntity to a new value.
Discussion
No response
Motivation
Keycloak resources url contains a special generated tag (yeqd3): https://hostname/auth/resources/yeqd3/login/MyTheme/css/common.css Because of it, on each keycloak version update, this tag is modified and browsers will drop old cache and load new files which could be modified. This works fine if we want to use standard keycloak theme. But if we add our own theme with our company branding to it, them such theme is cached too until we upgrade to a new version of keycloak (each keycloak version change generates a new tag, see MigrationModelAdapter). Then changes which we make to a theme are not visible for some of our customers, because themes were cached.
To resolve this issue we would need to either disable caching on production or change resource tag to a different value when we make an update to keycloak theme (we release own keycloak docker image which extends keycloak). Currently we are running SQL script which modifies this table but it depends on internal implementation details of keycloak schema:
UPDATE keycloak.MIGRATION_MODEL set id='$RESOURCE_TAG' where version in (select max(version) from keycloak.MIGRATION_MODEL);
Details
We could provide some way to change this via REST API or environment variable.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@raehalme Yes it would make sense. It is one of the proposal described in task description.
I’d say a better option would be to allow a theme to define its own version.
When generating the resource tag at startup we can check Keycloak version as well as theme versions, and create a new resource tag if any has changed.
An even better option may be to have a resource tag generated for each theme individually.