Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance documentation for hostname-port and hostname-admin-url #14473

Open
pleutres opened this issue Sep 18, 2022 · 1 comment
Open

Enhance documentation for hostname-port and hostname-admin-url #14473

pleutres opened this issue Sep 18, 2022 · 1 comment
Labels
kind/feature Categorizes a PR related to a new feature status/triage

Comments

@pleutres
Copy link

pleutres commented Sep 18, 2022

Description

I faced an issue by configuring :

hostname-port=443.
hostname-admin-url=https://mydomain/keycloak

I tried to access the console with https://mydomain/keycloak and stay blocked on the spinning waiting page without any clue.
Let's try to improve that :)

Discussion

No response

Motivation

To gain time in configuration resolution

Details

With a reverse proxy nginx and keycloak, login in admin console lead to be blocked on :

/realms/master/protocol/openid-connect/login-status-iframe.html/init?client_id=security-admin-console ....

With a 204 return code and no other errors.
I had to explore keycloak source code to find the cause ; this test failed in keycloak.js :
if ((event.origin !== loginIframe.iframeOrigin) in keycloak.js

After a (lot of) time of search, it appears that it compares :
https://mydomain/keycloak
and
https://mydomain:443/keycloak

because I'd setup hostname-port to 443 in keycloak.config
removing hostname-port make it works.

My keycloak configuration :

hostname=mydomain  
proxy=reencrypt  
hostname-strict=false  
#hostname-port=443  
hostname-path=keycloak  
http-relative-path=keycloak  
hostname-admin-url=https://mydomain/keycloak

2 ways to improve it :

  1. maybe add some lines in documentation to take care of this particular port as it is removed from adress bar by browser
  2. put a warn log in the keycloak.js for error case or if it creates to many logs, use a log level to add more information on keycloak behavior on client side ?
@pleutres pleutres added kind/feature Categorizes a PR related to a new feature status/triage labels Sep 18, 2022
@usagi-flow
Copy link

Thanks a lot for your analysis, it saved me (more) hours of research why KC wouldn't work with a reverse proxy anymore...

In addition to hostname-port being left empty, port 443 must also not be included in hostname-url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes a PR related to a new feature status/triage
Projects
None yet
Development

No branches or pull requests

2 participants