Cross-Origin Resource Sharing
Before we start: This section requires Ucommerce to be install through nuget
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources.
An example of a cross-origin request: the front-end JavaScript code served from https://ucommerce-content.com uses http to make a request for https://ucommerce-delivery.com/data.json.
In all our endpoints we already have taken care of the Cors issue. If you want to take advantage of that you will only need to decorate your controllers with our Cors
attribute, shown in the example below:
[RoutePrefix("")] [Ucommerce.Headless.Application.Cors] public class Cors : ApiController { [HttpGet] public IHttpActionResult GetData() { return Ok(); } }
NOTE This CORS feature is gonna change in a later version of Ucommerce.