@CrossOrigin

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

The application can be configured to generate the Access-Control-Allow-Origin CORS header by configuring the REST controller with @CrossOrigin. @CrossOrigin adds header that configure the browser to consume (or not) the API.

Example

@RestController
@RequestMapping(path="/inhabitants", produces = "application/json")
@CrossOrigin(origins="*")
public class InhabitantsController {
  ...
}