# Keycloak does not work behind a load balancer

**URL:** <https://forum.keycloak.org/t/keycloak-does-not-work-behind-a-load-balancer/10426>\
**Category:** Configuring the server\
**Tags:** admin-console\
**Created:** [August 6, 2021, 11:38am UTC](https://forum.keycloak.org/t/keycloak-does-not-work-behind-a-load-balancer/10426 "2021-08-06T11:38:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FurkanTheHuman](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/furkanthehuman/32/3673_2.png) [@FurkanTheHuman](https://forum.keycloak.org/u/FurkanTheHuman)\
**Post date:** [August 6, 2021, 11:38am UTC](https://forum.keycloak.org/t/keycloak-does-not-work-behind-a-load-balancer/10426/1 "2021-08-06T11:38:11Z")

</div>

I know there is a lot of similar questions but they don’t seem to work me.

I installed keycloak in a Kubernetes cluster using bitnami helm chart. This cluster is in a private VPN network. Normally I would use cert-manager to create certificates and enable HTTPS.

But in this scenario, I installed it without SSL and left the SSL stuff to load balancer in this private network.

The thing is it works but only some portions of it. At first, I was getting an invalid redirect error when I try to open the admin console. But then I added the DNS address to /etc/hosts file(this way browser says invalid cert but when I say accept the risk it works perfectly) and now I can login. After I login I changed to Valid URL in the secure-admin-console to \*.

Now I can login without the /etc/hosts hack but After I login I get:  
Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘[http://my-address.com](http://my-address.com)’) does not match the recipient window’s origin (‘[https://my-address.com](https://my-address.com)’).

Notice the difference is only about HTTP → HTTPS

I think this is about the X-Forwardes-For and X-Forwardes-Proto headers but I am not the sysadmin there. And I think sysadmin made the correct configuration

Can there be any other possible problem that I should focus on?

---

<div class="post-metadata">

**Author:** ![jangaraj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jangaraj/32/5175_2.png) [@jangaraj](https://forum.keycloak.org/u/jangaraj)\
**Post date:** [August 6, 2021, 1:06pm UTC](https://forum.keycloak.org/t/keycloak-does-not-work-behind-a-load-balancer/10426/2 "2021-08-06T13:06:46Z")

</div>

[https://www.keycloak.org/docs/latest/server\_installation/index.html#\_setting-up-a-load-balancer-or-proxy](https://www.keycloak.org/docs/latest/server_installation/index.html#_setting-up-a-load-balancer-or-proxy)

---

<div class="post-metadata">

**Author:** ![FurkanTheHuman](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/furkanthehuman/32/3673_2.png) [@FurkanTheHuman](https://forum.keycloak.org/u/FurkanTheHuman)\
**Post date:** [August 6, 2021, 4:21pm UTC](https://forum.keycloak.org/t/keycloak-does-not-work-behind-a-load-balancer/10426/3 "2021-08-06T16:21:58Z")

</div>

I tried those. No help. I am just curious about what the “Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided” message means.

I am not sure about what it indicates.
