-
|
I'm struggling with how to configure a production instance of Keycloak. Here is my particular setup: Client traffic is coming in from the internet to a public endpoint of: This traffic is forwarded from a gateway to a (private) Azure API Manager (APIM) instance. The k8s keycloak service is fronted by an Azure load balancer on a fixed private IP - call it 10.20.3.60. So the external TLS is being terminated at APIM, then forwarded as another TLS request to an internal hostname. So I have: So far so good, I have it deployed and I can hit the keycloak /health endpoint on the external and internal URLs. Now it's a little hazy how to complete the configuration.
I'm confused on how these parameters need to be set up: I think I'm maybe confused because I have two hostnames, essentially - and some of the terminology used in the guides feels ambiguous in this case. KC_HOSTNAME - Do I use my internal or external hostname? I assume internal - since I need keycloak to construct correct web urls when using the admin web console. But will this affect external clients in any way? Like If I'm brokering to an external identify provider - will the redirect URLs incorrectly try to use my internal hostname or other similar effects? KC_PROXY - edge, reencrypt, passthrough - What mode describes my scenario? If I'm passing /auth requests from the internet through APIM, the scenario looks like reencrypt. If I'm hitting the admin console from within my intranet there is no reverse-proxy terminating TLS. KC_HOSTNAME_STRICT_BACKCHANNEL - ? I want this false? - but the name is confusing. It seems like I'd only want backend endpoints to be accessible internally, but the docs say to set it to true when all traffic hits the public url. KC_HOSTNAME_PORT - do I need to mess with this - the actual keycloak service is listing on 8443, but the k8s service is listening on 443. I appreciate any help/enlightenment anyone can provide. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
|
For reference this is the Docker image I'm building and deploying to Kubernetes. |
Beta Was this translation helpful? Give feedback.
-
|
I'm trying various things, so far no luck. I am currently setting: I can now make a call from postman to get an OAuth token and I get the keycloak login dialog at this URL: However, as soon as I enter credentials, it directs to here and I get a 404: Also with the above config, I can reach the welcome page from my intranet with: I'll keep hammering at it, but would greatly appreciate if anybody happens along with some insight. Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
Here is a simplified diagram of what I'm trying to achieve - this should be supported, yes? |
Beta Was this translation helpful? Give feedback.
-
|
Solved the larger part of my problem - my proxy/apim instance was only allowing GET requests through, and the intermediate call made after logging in from the browser is a POST to /login-actions/authenticate?... . So I can authenticate external clients now. |
Beta Was this translation helpful? Give feedback.
-
|
Solved the problem of accessing keycloak from my intranet too. It turns out that when accessing the keycloak portal from my private hostname, the logon dialog still uses the public hostname - and my jumphost in the intranet was not resolving my public hostname. This looks like a likely keycloak bug to me. In other words - when accessing keycloak portal on my intranet and trying to navigate to here: In the Chrome debug trace, I saw an error trying to hit the public name: Once I added the hostname/ip to the hosts file - it started working. |
Beta Was this translation helpful? Give feedback.
Solved the problem of accessing keycloak from my intranet too. It turns out that when accessing the keycloak portal from my private hostname, the logon dialog still uses the public hostname - and my jumphost in the intranet was not resolving my public hostname. This looks like a likely keycloak bug to me.
In other words - when accessing keycloak portal on my intranet and trying to navigate to here:
https://keycloak.internal.private/admin/master/console/
In the Chrome debug trace, I saw an error trying to hit the public name:
https://mydomain.com/kc/realms/master/protocol/openid-connect/3p-cookies/step1.html?version=uz088
Once I added the hostname/ip to the hosts file - it started working.