Keycloak behind Kong and strange redirect
Original answer:
Seems, it is necessary to setup following environment variables in values.yaml of keycloak helm chart:
... extraEnv: | - name: KEYCLOAK_HTTP_PORT value: "80" - name: KEYCLOAK_HTTPS_PORT value: "443" - name: KEYCLOAK_HOSTNAME value: example.com...
All of them are required, after that, redirect would work correctly.
Added 2021 Sep:
Issue with weird behavior with redirect to port 8443 for some action (like go to Account management with the link on the top right of admin console).
In fact we do not need to set any KEYCLOAK_HTTP_PORT
or KEYCLOAK_HTTPS_PORT
.
Some changes are required on proxy side. On proxy we need to set x-forwarded-port
to 443
for this route.
In my case we use Kong:
On the route, where Keycloak is exposed, we need to add (this one worked for me):
serverless
> post function
with following content:
ngx.var.upstream_x_forwarded_port=443