Keycloak in AWS with ALB

I installed two EC2 instances, each running Keycloak in standalone-ha mode with one RDS database. I put AWS Application Load Balancer in front of the instants.

Configured Discourse test forum with OpenID plugin for Keycloak authentication. And from that moment on the weirdness began…
I go to the main page of the test forum:

I click Login and go to the Keycloak instance that AWS ALB selects:

I log in there and return me to the main page of the forum with the following error:

After several cycles “go to the main page of the forum → refresh the page → click Login” a miracle happens - suddenly the session is picked up! And I enter the forum:

AWS ALB settings:


AWS ALB Listeners:

AWS ALB Target Group:

I’m sure this is some kind of problem in the ALB-Keycloak bundle.
Because when I turn off one of the two targets in the ALB Target Group, any - the problems go away, authorization occurs immediately, without errors.

Can someone tell me what I misconfigured? Thanks a lot in advance!