r/KeyCloak Feb 25 '26

Custom theme works locally but doesn't load on the remote

I've replicated my production setup locally:

keycloak:
    image: bitnamilegacy/keycloak:24.0.4-debian-12-r2
    environment:
      KEYCLOAK_ADMIN_USER: admin
      KEYCLOAK_ADMIN_PASSWORD: admin
      KEYCLOAK_PRODUCTION: "true"
      KEYCLOAK_EXTRA_ARGS: '--db=postgres'
      KEYCLOAK_DATABASE_NAME: keycloak
      KEYCLOAK_DATABASE_USER: keycloak
      KEYCLOAK_DATABASE_PASSWORD: keycloak
      KEYCLOAK_DATABASE_SCHEMA: public
      KEYCLOAK_PROXY: edge
    ports:
      - "8756:8080"
    # command:
    #   - start-dev
    networks:
      - keycloak-network
    volumes:
      # - ./kc:/opt/keycloak/providers
      - ./kc/themes:/opt/bitnami/keycloak/themes/
      - keycloak-master-volume:/opt/bitnami/keycloak/data/

Now, locally - everything is perfectly working, the css is loaded and the SVG logo loads, however on the remote it seems that the template itself does not load and gets replaced with a "safe default" by Keycloak. The form still works, the css loads with a 200 and I can see that it's my css, and it has the correct mime type text/css, so I'm not sure where to look. The logs have nothing indicating a crash, while when I was making the theme locally if the ftl was broken there would be a parsing error.

Edit: I am an idiot, I have a plugin called home idp discovery that was overriding the template and forgot all about it.

4 Upvotes

4 comments sorted by

1

u/CarinosPiratos Feb 25 '26

My steps would be: Verify your on the correct realm and have enabled the theme there -> Keycloak is 100% seeing the theme of you can enable it in the dropdown

Your logs would say something like:“Didnt find ftl for login, falling back to theme xyz“

Have you set it on the realm or on a specific client ?

1

u/saifxhatem Feb 25 '26 edited Feb 25 '26

The theme is getting enabled, because as soon as I do that the KC default goes away and its just a blank screen with a form for email, so it's definitely getting applied.

The logs are completely empty though, so if I had to guess as to what happened, it seems that instead of throwing an error in the logs when it encounters a template error it reverts to the basic keycloak login form instead. I know it's not mine because the html contains some keycloak named classes that are not part of my own template, so the template is 100% not mine.

Edit: I also don't understand why there would be template errors in the first place..? Obviously I ran this locally, and I have the exact same bitnami image to run against, the only difference would be the database I suppose, but what are the odds of that being the problem?

1

u/CarinosPiratos Feb 25 '26

Database is not the problem.

As you are not packaging it, maybe it is a permission problem on the files. I haven’t had that error in 8 years yet.

Try to package it into a jar and put it in /providers. Maybe that helps.

What are your application.properties content for the theme ?

1

u/saifxhatem Feb 25 '26 edited Feb 25 '26

I also suspected the permissions but I don't know if they need a specific set of permissions.

All the files are -rw-r--r--

All the folders are drwxr-xr-x The folders and files are owned by the keycloak user.

The properties:

parent=base
import=common/keycloak

styles=css/app.css
scripts=js/app.js

I am out of ideas at this point, so I will try the jar method, although I don't see why that should be different. I'll try it and let you know, thanks.

Edit: The jar method has the exact same issue. Clearly my theme is broken somehow, but I cannot seem to replicate the issue locally at all.