Home > Mobile >  Keycloak redirecting to Hostname but with port number too
Keycloak redirecting to Hostname but with port number too

Time:12-24

I have configured nginx and given hostname to keycloak as http://keycloak.formsflow.ai for localhost:8080, but as I see in redirection url it show port number 8080, how can I remove it?

Keycloak showing port number in redirection along with hostname Below is my docker config for keycloak


  keycloak:
    image: quay.io/keycloak/keycloak:14.0.0
    container_name: keycloak
    volumes:
      - ./configuration/imports:/opt/jboss/keycloak/imports
    command: 
      - "-b 0.0.0.0 -bmanagement=0.0.0.0 -Dkeycloak.import=/opt/jboss/keycloak/imports/formsflow-ai-realm.json -Dkeycloak.migration.strategy=OVERWRITE_EXISTING"
    environment:
      - DB_VENDOR=POSTGRES
      - DB_ADDR=keycloak-db
      - KEYCLOAK_HOSTNAME=keycloak.formsflow.ai
      - DB_DATABASE=${KEYCLOAK_JDBC_DB:-keycloak}
      - DB_USER=${KEYCLOAK_JDBC_USER:-admin}
      - DB_PASSWORD=${KEYCLOAK_JDBC_PASSWORD:-changeme}
      - KEYCLOAK_USER=${KEYCLOAK_ADMIN_USERNAME:-admin}
      - KEYCLOAK_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD:-changeme}
    ports:
      - 8080:8080

config to set for keycloak to remove port number from redirection url

CodePudding user response:

When behind a reverse proxy, configure Keycloak properties:

  • PROXY_ADDRESS_FORWARDING=true
  • KEYCLOAK_FRONTEND_URL=http://keycloak.formsflow.ai/auth

You may also need to configure headers X-Forwarded-Proto and X-Forwarded-Host in Nginx.

  • Related