Keycloak removes port from redirect_uri

Weird problem: the url that is secured with Keycloak is testserver:8081/application. The redirect happens, but the keycloak-page gives an error:

invalid parameter: redirect_uri.

When I look at the redirect_uri in the url I notice something strange; the port is omitted, it just shows


Why did Keylcoak filter away the port??

If I manually adjust the url (I add the port - 8081) it works just fine…I’m confused.

Can you show us an example of what library you’re using (keycloak-js?) and how you’re using it? Some more context would be helpful in debugging.

1 Like

I’m using Keycloak to secure a java-app (Vaadin), so i’m using a java-adapter. Securing my application by adding my secured path in the web.xml.

When I run my app locally on localhost, it all works perfect. I get redirected to our test-keycloak-server and I can login and everything. But once deployed on our test-server (tomcat) I get this strange behavior.
Maybe one thing to note: our testserver doesn’t use https, could this explain anything?

Also, the ‘Valid Redirect URIs’ you need to set in Keycloak are set correctly.

The first problem I had was that instead of removing the port Keycloak removed it and added ‘0’, giving me this url:


I solved this by adding ‘confidential-port: 443’ to my keycloak.json, and so now it completely strips away the port-number…