@CrossOrigin: Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Spring_Security_Concepts#CORS_Support|Spring Security Concepts]] | |||
* [[Spring_REST_Concepts#Annotations|Spring REST Concepts]] | * [[Spring_REST_Concepts#Annotations|Spring REST Concepts]] | ||
* [[Cross-Origin_Resource_Sharing#CORS_Support_in_Spring|CORS]] | |||
=Overview= | =Overview= | ||
The application can be configured to generate the [[Cross-Origin_Resource_Sharing#Access-Control-Allow-Origin|Access-Control-Allow-Origin]] [[Cross-Origin_Resource_Sharing#CORS_Support_in_Spring|CORS]] header by configuring the REST controller with @CrossOrigin. @CrossOrigin adds header that configure the browser to consume (or not) the API. | |||
=Example= | =Example= |
Latest revision as of 23:49, 29 March 2019
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 {
...
}