Main Content

cors-allowed-origins

Specify the domain origins from which clients are allowed to make requests to the server

Syntax

--cors-allowed-origins [ LIST | * ]

Description

cors-allowed-origins specifies the set of domain origins from which clients are allowed to make requests to a MATLAB® Production Server™ instance. Cross-Origin Resource Sharing or CORS defines a way in which client-side web applications and a server can interact to safely determine whether or not to allow a cross-origin request. Most clients such as browsers use the XMLHttpRequest object to make a cross-domain request. This is especially true for client code written using JavaScript®. For MATLAB Production Server to support such requests, you must enable cors-allowed-origins on the server.

Parameters

*

Requests from any domain origin are allowed access to the sever.

LIST

Requests from a list of comma-separated domain origins are allowed access to the server.

Examples

  • For on-premises server instances created using the command line, update this server configuration property in the main_config server configuration file.

  • For on-premises server instances created using the dashboard and for server deployments in the cloud, use the dashboard and cloud dashboard, respectively, to update the server configuration property.

Configure Using Command Line

Allow Requests from Any Domain Origin to Access Server

In the main_config file, set the cors-allowed-origins property to the following:

--cors-allowed-origins *

Allow Requests from Specific List of Domain Origins to Access Server

In the main_config file, set the cors-allowed-origins property to the following:

--cors-allowed-origins http://www.w3.org, https://www.apache.org

Configure Using Dashboard

Allow Requests from Any Domain Origin to Access Server

In the main_config file, set the cors-allowed-origins property to the following:

*

Allow Requests from Specific List of Domain Origins Access to Server

In the dashboard, in the Settings tab of your server instance, under HTTP, enter the following for the CORS Allowed ORigins property:

http://www.w3.org, https://www.apache.org

See Also