Redirect Base URL to Account Console in Keycloak

Hi Keycloak Community,

Is it possible to configure Keycloak so that the base URL (http://your.keycloak.domain) automatically redirects users to the user account console (http://your.keycloak.domain/realms/master/account) instead of the admin console? If so, what is the recommended way to achieve this without using an external reverse proxy?

Thank you!

1 Like

Hi @Flo00,
A way to do it comes to mind, but I haven’t tried it before.

Server Development - Themes
It is possible to create a custom welcome theme to redirect user to desired address.

Hey, I found an example for you. It seems like someone else has asked about this before. I hope it helps!

1 Like

Hi @ozdemirrulass,

Thank you for your reply

Yes of course that would be possible, I have been searching for days in the settings, I personally think it would be cool if this would be possible as a standard feature

Thank you very much

1 Like

Yes indeed, it should be an optional feature.

Another way to do it:
Keycloak uses wildfly as an application server and it is also possible to configure a redirect in that layer.

1 Like

This is no more the case since KC17, that’s where they switched to Quarkus as underlying framework. (from 17 - 20 there was the “legacy” distribution, still running on Wildfly, but since 21, there’s only Quarkus!)

2 Likes

The system I work on the most still uses 20. Unfortunately, I haven’t worked much with versions over 20 other than minor support work. Thanks for the info @dasniko .

Both quarkus and wildfly uses Undertow as a web server so it shouldn’t be so different to handle it in webserver layer but also it should be even easier with quarkus to handle this programmatically since you can add route handlers like:

 @Route(path = "/xyz", methods = HttpMethod.GET)
    void handleRequest(RoutingContext context) {
        context.response()
               .putHeader("location", "/abc")
               .setStatusCode(302) 
               .end();
    }

I like the first suggestion more

My gut feeling is that it might be less of a problem to use a template when upgrading to a newer version than to change something in the WebServer configuration.

It certainly is a better and easier way. I just like poking things.

1 Like

Quarkus can use Undertow. However, Quarkus uses by default Vert.x, and also Keycloak uses Vert.x by default, no Undertow.

2 Likes

Interesting, it wasn’t a topic I particularly paid attention to before. I assumed it is using Undertow by default, as I had made some small changes on a Keycloak setup before and worked on Undertow. So, it means it was specifically configured to use Undertow.
It looks like there are some documents I need to read. Thanks @dasniko.

1 Like

Hi @Flo00
I agree with you … there should be a redirect by default when use Frontend URL atribute.
Now it just redirect to master realm login form and it make no sense.

1 Like