Saturday, November 4, 2017

Spring boot supports Cross domain request (CORS)

https://spring.io/guides/gs/rest-service-cors/

@CrossOrigin(origins = "http://localhost:9000")

This @CrossOrigin annotation enables cross-origin requests only for this specific method. By default, its allows all origins, all headers, the HTTP methods specified in the @RequestMappingannotation and a maxAge of 30 minutes is used. You can customize this behavior by specifying the value of one of the annotation attributes: origins, methods, allowedHeaders, exposedHeaders, allowCredentials or maxAge. In this example, we only allow http://localhost:9000 to send cross-origin requests.

https://vimsky.com/article/2252.html

No comments:

Post a Comment