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
liveview.properties 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
* characters are converted to
. characters are escaped to \
. and the resulting allowed origin interpreted as a regular expression. Allowed origins can therefore be more complex expressions
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
The following examples contains the same origin because the scheme (http) and host (example.com) are identical:
The following examples contains the same origin because a server delivers HTTP content through port 80 by default and case-insensitive:
The following examples contain different schemes:
The following examples contain different hosts:
http://example.com http://www.example.com http://myapp.example.com
The following examples contain different ports: