Determining domain of redirect URI for IDP

How does Keycloak determine the domain for the redirect URI for an IDP set up for a realm? Seems like it’s pulled off of the host header on the request to create the IDP. I was able to set a redirect uri to http://foo.com/auth/realms/realmName/broker/testIDP/endpoint, which seemed odd to me. I would think that the domain is configurable in some way other than using the host header.