question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to override keycloak resource tag for fixing issue with browser caching

See original GitHub issue

Description

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);

Also see: https://medium.com/@hokumski/how-to-drop-keycloak-theme-cache-without-clearing-browser-data-aebb499ae83b

Details

We could provide some way to change this via REST API or environment variable.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jowkocommented, Sep 21, 2022

@raehalme Yes it would make sense. It is one of the proposal described in task description.

0reactions
stianstcommented, Sep 23, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow to override keycloak resource tag for fixing issue with browser ...
To resolve this issue we would need to either disable caching on production or change resource tag to a different value when we...
Read more >
Versioning of Themes · Issue #10946 · keycloak ... - GitHub
Description Hi, i would like to introduce something like new property for themes named version. The version should be a part of the...
Read more >
Configuring distributed caches - Keycloak
To explicitly enable distributed infinispan caching, enter this command: ... authorization and related data like resources, permissions, and policies.
Read more >
keycloak CORS filter spring boot - java - Stack Overflow
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.
Read more >
How to drop Keycloak theme cache without clearing browser ...
Highlighted part is called “resource tag”, and if you know how to make Keycloak to change tag after your update, that makes URLs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found