LPS-37866 Don't fall back to localhost if the portal is accessed throught a non-localhost URL
LPS-37866 Extended integration test
LPS-37866 SF