CORS errors when having more than 1 replicas in stateful set

Hey guys, we are experiencing a really strange issue when using Keycloak with a frontend application. Keycloak is deployed via the keycloak helm chart from codecentric: helm-charts/charts/keycloak at master · codecentric/helm-charts · GitHub

Versions:
Helm chart: 8.2.2
Kubernetes: 1.11.0
Keycloak: 12.0.4
Client-Library: keycloak-angular in version 8.1.0 (keycloak-angular - npm)

Yeah, some of these are very old versions, but we currently have no control over the Kubernetes version.

What’s the problem?

When having Keycloak deployed with one replica in the stateful set, everything is working fine.

However, when we scale up to 2 replicas, we experience a CORS error (MissingAllowOriginHeader) when requesting the account endpoint from Keycloak via the browser (which the keycloak-angular library does automatically). When checking the response from the server, there is really no “Access-Control-Allow-Origin” header sent to the browser.
This only happens when having more than 1 replicas.

Do you have any idea, why that might happen?
I would appreciate any hint in the right direction :+1:t3: Thanks in advance.

Tested it also with the latest Keycloak Helm Chart (slightly modified to be compatible with our Kubernetes version).
Same situation unfortunately. We have the CORS error.

We upgraded Keycloak lately from version 10.0.2 to 12.0.4.
AFAIK, the scaling worked before upgrading.
Maybe this had an impact.