Problem with custom login page

Hello,

this is my first message.

I have Keycloak 12.0.3 running in a standalone mode. I’m following this guide Server Developer Guide to customize the login page. I created the folder and activated it in the admin page (custom theme). While having these options active in standalone.xml everything works fine

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

But the guide also says that when you’re done customizing you should re-enable the cache for performance, but when I do that using the default values

<staticMaxAge>2592000</staticMaxAge>
<cacheThemes>true</cacheThemes>
<cacheTemplates>true</cacheTemplates>

I no longer see the modifications I made. I’ve tried cleaning the cache of every browser I tried (FF, Brave, Chrome, etc), activating the Disable cache checkbox in the Dev tools windows and I keep getting the cached templates, the base ones. I only see the messages I created under /messages/messages_en.properties, so I know that the theme was created correctly.

Is there something else I should clean? Is it really a big issue to have cache disabled when I only have the login page customized? It’s also for internal use so there are not too many people accesing the page.

Thanks in advance. If you need more info just let me know.

Eric,

When you set cacheThemes and cacheTemplates back to true, it will no longer reload them (internally). This is not a dev tools or browser thing. The server either caches the templates or reloads them. If you want to make modifications, and have them picked up, either set cacheThemes and cacheTemplates back to false, or restart the server.

If you don’t have much traffic, it shouldn’t be a problem to have it set to false.

1 Like

@xgp Thank you for your answer, but I’m a little bit confused with this statement

If you want to make modifications, and have them picked up, either set cacheThemes and cacheTemplates back to true

Afaik that’s what I did, first I set it to false and when I was done customizing I set those back to true again. But that didn’t work.

By restart the server I understand shutting down the process and start it over again. That’s what I do after I made changes, I’m not aware of any command to reload the server. But still, that didn’t work either.

I’m planning to let them as false since it’s the only option that worked for me.

Thanks again, I really appreciate your answer!

Sorry. I meant “back to false”.

Not sure why it didn’t pick up your changes after a server restart. Regardless of the cacheThemes and cacheTemplates values, it should pick up changes.

Ok, good news. The guide says as follows

Themes can be deployed to Keycloak by copying the theme directory to themes or it can be deployed as an archive

This wasn’t true in my case. If I put the folder under themes keycloak recognizes it but it doesn’t apply it (with cache turned on; with cache turned off it works).

So I kept reading and I tried what it’s suggested under Server Developer Guide. I created a jar file, moved it to /standalone/deployments, keycloak saw it immediatly, I selected it in the admin console and it was applied immediatly with cache turned on.

I think the guide is a little bit misleading. In any case it worked.

Thanks for your help!

1 Like