Fixes #4536 Get the remote_user from multiple sources in a preferred order