Keycloak reverse proxy

Hello!
Please help solve problem with proxying.
I am using the following scheme:
Keycloack (ver 5.0) is running in a container on Kubernetes. Web access via ingress (url: http://xxx.k8s.com:30000/)
External requests are proxied to ingress from url: https://yyy.com/ (nginx)
When I get to the authorization page, I see in html tag “form”: <form id =“kc-form-login” onsubmit=“login.disabled=true; return true;” action="http://xxx.k8s.com:30000/auth/realms/..." instead of "https://yyy.com/auth/realms/..."
How to configure that it uses the correct url.

I guess you are using official jboss/keycloak:latest image:

Configure the environment variable PROXY_ADDRESS_FORWARDING=true for Keycloak containers. Doc https://hub.docker.com/r/jboss/keycloak :

When running Keycloak behind a proxy, you will need to enable proxy address forwarding.

docker run -e PROXY_ADDRESS_FORWARDING=true jboss/keycloak

jangaraj, thanks for the answer.
I tried set env PROXY_ADDRESS_FORWARDING=true, and CLI /opt/jboss/keycloak/bin/jboss-cli.sh --connect \ "/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true)"
but this did not help.

1 Like