Keycloak 22.5 behind load balancer and Nginx

Dear Prof ,

I need help , I am stuck on this issue for a while ,

my domain mydomain is secured , we are using load balancer to offloading the certificates and behind load balancer I have my nginx server with multiple locations , everything working smoothly accept my sso location that redirect me to my keycloak server , here is my nginx conf :

location /sso/  {
			proxy_set_header		Host			          $http_host; # to forward the original host requested by the client
			proxy_set_header 		X-Forwarded-For           $http_x_forwarded_for; # To forward the original client's IP address 
			proxy_set_header 		X-Forwarded-Proto 		  https; # to forward the  original protocol (HTTP or HTTPS)
			proxy_set_header        X-Forwarded-By            $server_addr:$server_port;
			proxy_set_header        X-Real-IP                 $remote_addr;
			proxy_pass http://localhost:8081;
		}

Now , when I am opening https://mydomain.com/sso I got redirected to https://mydomain:8080/sso , if I remove 8080 everything works great and I can logon into admin console .

I started my clock on port 8081 las below :
kc.bat start --http-port 8081 --http-relative-path /sso --proxy edge --hostname-strict=false.

Please help

Hi,
Try setting hostname or hostname-url explicitly.
See the guides for more info:

Cheers.