Hostname configuration Keycloak 19.0.1

Viewed 29

I'm running keycloak version 19.0.1 with no proxy and I want to set a hostname (mykeycloak) as a frontend url to my realm.  I run the keycloak with the command below:

.\kc.bat start-dev --hostname mykeycloak --proxy edge 

The configuration endpoint (http://localhost:8080/realms/master/.well-known/uma2-configuration) shows :

{"issuer":"http://mykeycloak/realms/master","authorization_endpoint":"http://mykeycloak/realms/master/protocol/openid-connect/auth",...

I also add the below record to my etc/hosts:

127.0.0.1   mykeycloak

Finally when I want to open the mentioned endpoint (http://mykeycloak/realms/master)  I face This site can’t be reached- ERR_CONNECTION_REFUSED

Am I missing something?

At last, this configuration won't work in a public network unless everyone adds the mykeycloak record to their dns.

So what would be the solution that way?

1 Answers

It looks like you are simply missing the port, i.e. it should be http://mykeycloak:8080/realms/master.

If you want to have keycloak accessible on default ports, e.g. 80 or 443, you either need a proxy running on those ports, forwarding to keycloak on 8080 and 8443, or you run keycloak itself on those ports (but that's a bad idea for security reasons).

Related