Configuration Environment Variables KC_* are not working

Hello everyone,

Environment variables that start with KC_ as specified in the official documentation are not working out of the box. Not sure if there is something to be done in order for them to get captured by Keycloak, but I see this as counter intuitive.

Here is roughly my docker compose keycloak definition:

    image: quay.io/keycloak/keycloak:19.0.1
    environment:
      KEYCLOAK_ADMIN: admin
      KEYCLOAK_ADMIN_PASSWORD: admin
      KC_HTTP_ENABLED: "true"
      KC_HOSTNAME: auth-server
      KC_HOSTNAME_PATH: /auth
    ports:
    - "8080:8080"
    entrypoint: ["start"]

Keycloak is serving at / and not /auth which means that KC_HOSTNAME_PATH is ignored

I know this question have been asked at least two times here:

but I did not find any clear answer to the question yet.

I think you’re looking for the KC_HTTP_RELATIVE_PATH variable. From the docs:

Set the path relative to ‘/’ for serving resources.

2 Likes

Thanks this was the issue indeed.