@CrossOrigin

From NovaOrdis Knowledge Base
Revision as of 23:49, 29 March 2019 by Ovidiu (talk | contribs) (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 {
  ...
}