keycloakfreemarker

Keycloak CSS is not updating in browser


I am upgrading Keycloak from 9.x to 12.x in a development environment. I initially copied some custom themes forward, and found that the styling was badly broken (no surprise). I reviewed my FTL files, copied some of the core changes into my theme, and things are much better - just some minor issues to adjust.

Now the problem. I've made the changes to my login.css file, but those changes aren't showing up in the browser. It continues to fetch an old version of my custom CSS file.

What I have tried (multiple times for most of these):

I've also now grepped the entire Keycloak directory for some of the CSS rules I've removed, and I can't find any copies of the "old" css file anywhere that might be getting referenced by accident.

Also, there are no messages in the Keycloak log when loading the CSS file.

I want to figure out how to get Keycloak to deliver the updated CSS to the browser.


Solution

  • Blind guess, so please don't blame me if it doesn't work. (question should include minimal reproducible example):

    Edit /opt/jboss/keycloak/standalone/configuration/standalone-ha.xml and update it as follows:

    <theme>
      <staticMaxAge>-1</staticMaxAge>
      <cacheThemes>false</cacheThemes>
      <cacheTemplates>false</cacheTemplates>
      
      ...
      
    </theme>