Cross-Origin Resource Sharing


LiveView supports Cross-Origin Resource Sharing (CORS) by enabling one resource origin (for example, a LiveView server on the back end) to share LiveView data with another server (such as a customer's front end web server).

You configure origin resource sharing by setting a property in a file. For example:


The property can contain a comma-separated list of origins that are allowed to access the resources, where an origin is defined by the URI scheme (such as protocol), host (domain), and port of the URL used to access it. Note that two objects are the same origin when the scheme, host, and port all match.

The default value is http://localhost, meaning by default, nobody can request from cross domain sites.

Using a value of * means allow all origins. For example:


If an allowed origin contains one or more * characters (for example http://*, then * characters are converted to .* whereas . characters are escaped to \. and the resulting allowed origin interpreted as a regular expression. Allowed origins can therefore be more complex expressions such as https?://*.domain.[a-z] that matches http or https, multiple subdomains, and any three-letter top-level domain (such as .com, .net, .org, and so on).

Examples of Same Origins

The following examples contains the same origin because the scheme (http) and host ( are identical:

The following examples contains the same origin because a server delivers HTTP content through port 80 by default and case-insensitive:

Examples of Different Origins

The following examples contain different schemes:

The following examples contain different hosts:

The following examples contain different ports: