#488 several improvements in redirect uri domain handling