Non-private IP access to HTTPS, Infinitely repeated redirection operation

Detailed description:
Keycloak will be deployed in the virtual machine, using port mapping to expose the port and access port 8443 using the host machine’s IP address.
When accessing keycloak on https through a non-private IP address, the problem shown in the figure occurs. Keycloak repeatedly requests several interfaces indefinitely and cannot enter keycloak normally. However, there is no problem accessing keycloak on https within a private IP address.

Keycloak version: 21.1.2
PostgreSQL version: 16

Problem reproduction:
1. Modify the database connection information in keycloak.conf

2.Modify the ‘hostname’ of keycloak.conf to the private IP address of the server where keycloak is located

3. Use this command to generate the keystore in the conf folder: keytool -genkeypair -alias localhost -keyalg RSA -keysize 2048 -validity 365 -keystore server.keystore -dname “cn=Server Administrator,o=Acme,c=GB” -keypass secret -storepass secret

4. Run keycloak using this command: ./kc.sh start --https-key-store-password=secret