When adding a service to Map Viewer in Portal for ArcGIS, the following error is returned:
Error: The <service type> service, <service URL>, cannot be added to the map. It's either not available or you have entered an invalid URL for the type of layer you want to reference.
The Console tab in the developer tools of the browser also shows the following error:
Error: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
The host name of the service is added as a trusted server in the organization's security settings. This caused the credentials to be sent when making Cross-Origin Resource Sharing (CORS) requests to access services secured with web-tier authentication. The credentials are incompatible with the CORS header present in the service by default.
Remove all servers from the Trusted Servers section if web-tier authentication is not used. To remove a server in Trusted Servers, follow the steps below: