Partilhar via


Cross-Origin Resource Sharing

Important

This content is being retired and may not be updated in the future. The support for Machine Learning Server will end on July 1, 2022. For more information, see What's happening to Machine Learning Server?

Applies to: Machine Learning Server, Microsoft R Server 9.x

Cross-Origin Resource Sharing (CORS) enables your client application to freely communicate and make cross-site HTTP requests for resources from a domain other than where the web node is hosted. You can enable or disable CORS in the external configuration file, appsettings.json. Support for CORS is disabled by default.

To enable CORS support:

  1. On each web node, open the configuration file, <web-node-install-path>/appsettings.json. (Find the install path for your version.)

  2. Enable CORS in the "CORS": { section of the appsettings.json file:

    1. Set CORS "Enabled": true

    2. Enter a comma-separated list of allowed "Origins" for your policy. In this example, the policy allows cross-origin requests from https://www.contoso.com, https://www.microsoft.com, and no other origins.

      "CORS": {
      "Enabled": true,
      "Origins": ["https://www.contoso.com", "https://www.microsoft.com"]
      }
      
  3. Launch the administrator's utility and restart the web node.