I have surfed through google without finding any concrete answers or examples, so again trying my luck here (often get lucky).
You need to inform keycloak about the location of the reverse proxy. Then in its response it will set location to there instead of its local address. To do that in the latest keycloak set the environment variable 'KEYCLOAK_FRONTEND_URL' to point to
the string https://example.com/auth (yes, it needs the whole address.
To make this work, also set PROXY_ADDRESS_FORWARDING to the value true
If it's a Docker container, that means:
environment:
...
PROXY_ADDRESS_FORWARDING: "true"
KEYCLOAK_FRONTEND_URL: "https://example.com/auth"
Alternately, you can set KEYCLOAK_HOSTNAME to example.com and that will leave the port number, for which???(not sure how to do this part yet, if you find out please let me know... ) )